ajax 呼び出しを使用して単純なコピーを実行したいと考えています。これは私のコードですが、動作しません。i kepp gets : a copy(../../images/merchant/particulars/208/) failed to open stream: Is a directory in some/filepath on scriptname.php 行 x 、一種のエラー。
corrected code:
$dir_to_make = '../../images/merchant/particulars/'.$copytothisstore;
$dir = '../../images/merchant/particulars/'.$copytothisstore.' /'.$copyvalue;
$image_to_copy = '../../images/merchant/particulars/'.$copyfromthisstore.'/'.$copyvalue;
if(is_file($image_to_copy)){
//chk if there is a folder created for this store
if(!is_dir($dir_to_make)){
mkdir($dir_to_make, 0755);
chmod($dir_to_make, 0755);
//copy the image
if (!copy($image_to_copy,$dir)) {
echo "failed to copy $image_to_copy\n";
} else {
echo"all is well!!";
}
} else {
chmod($dir_to_make, 0755);
if (!copy($image_to_copy,$dir)) {
echo "failed to copy $image_to_copy\n";
} else {
echo"all is well!!";
}
}
echo"$image_to_copy does exist!";
} else{
echo"$image_to_copy does not exist!";
}