我有一个上传的文件,当试图将它保存到文件系统时,它只是失败。
我var_export($_FILES['bom_file'])
产生PHP:“move_uploaded_file()”失败,没有任何有用的信息
array (
'name' => '_bomUpload.tester.csv',
'type' => 'application/octet-stream',
'tmp_name' => 'C:\\wamp\\tmp\\php837A.tmp',
'error' => 0,
'size' => 265,
)
这是我的move_uploaded_file()
尝试:(我已与一些差异文件路径试过)
$file_path = 'C:/wamp/NetBeansProjects/BomProject/application/uploads/boms/testfile.csv'; // For Testing ---->
$testVar = move_uploaded_file($_FILES['bom_file']['name'], $file_path);
echo ($testVar)? 'The file has been uploaded': 'There was an error uploading the file';
echo '<pre>UPLOAD?: ', var_export($testVar), '</pre>'; // For Testing ---->
我一直想起来的错误消息,$testVar
是FALSE。
我在想什么?
确保Web服务器下运行的用户有写权限到目标位置。确保该属性中的文件夹不是“只读”。 – Dutchie432
@ Dutchie432:“你的Web服务器是Windows还是Unix?” ''tmp_name'=>'C:\\ wamp \\ tmp \\ php837A.tmp','o_O – zerkms
没有看到那里。 [耸肩]。 – Dutchie432