我有一个tmp文件夹,用于保存临时上传的照片,用户单击保存按钮后,照片将被移动到一个新文件夹。
$ori=$tmp_prefix.$select_array['photo']; //../user_data/tmp_chron/tmp_chronicle/kesongxie/HZi7DkRMvEIa6qc/22.jpg, this is the original files in temparary folder
$new=$prefix.$select_array['photo']; //../user_data/chron/chronicle/kesongxie/HZi7DkRMvEIa6qc/22.jpg , this is the folder I want to move to
rename($ori,$new);
我无法将文件移动到另一个文件夹,这会给我一个警告,没有任何细节建议
警告:重命名(../user_data/tmp_chron/tmp_crofile/kesongxie/HZi7DkRMvEIa6qc/22.jpg/user_data/chrn/chronicle/kesongxie/HZi7DkRMvEIa6qc/22.jpg)在edit.php第34行
在移动文件之前创建父目录
mkdir(dirname($new), 0777, true);