我想使用 ajax 调用做一个简单的复制。这是我的代码,但它不起作用。我不断得到:副本(../../images/merchant/particulars/208/)未能打开流:是 scriptname.php 行 x 上的 some/filepath 中的目录,有点错误。
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!";
}