我想在臨時文件夾中上傳的文件移動到新的文件夾...的oldpath
和newpath
是正確的,但該文件不動...我試圖var_dump
的move_uploaded_file
並得到結果布爾(假)move_uploaded_file不起作用?
以下是我的代碼:
$theid = Yii::app()->user->getState('id');
$folder = 'developers_apk'.DIRECTORY_SEPARATOR .$theid;
if(!is_dir($folder)){
mkdir($folder, 0755);
}
if(file_exists($folder)){
$today = date("Ymd");
$oldpath = Yii::app()->params['tmp_folder'] .$today.DIRECTORY_SEPARATOR.$apkfilename;
$newpath = 'developers_apk'.DIRECTORY_SEPARATOR .$theid.DIRECTORY_SEPARATOR.$apkfilename;
move_uploaded_file($oldpath,$newpath);
if(move_uploaded_file($oldpath,$newpath)){
print_r("ok");
}else{
var_dump(move_uploaded_file($oldpath,$newpath));
print_r("NOT");
}
}else{
print_r("NOT");
}
我錯過出頭?或者對此有何建議?謝謝
能爲你傾倒的2個變量? ''move_uploaded_file()'調用之前調用'var_dump($ oldpath);'''var_dump($ newpath);''。 – 2014-11-04 07:30:49
@Glavić'串(75) 「C:\ XAMPP \ htdocs中\ dev的\開放\ TEMP \ 20141104 \ 5b224412ed04f28c8b2d34320a66321d.apk」 串(54) 「developers_apk \ 66 \ 5b224412ed04f28c8b2d34320a66321d.apk」' – TheSmile 2014-11-04 07:32:46
@Glavić路徑看起來是正確的 – TheSmile 2014-11-04 07:34:08