我正在尝试使用php脚本将文件从Android代码上传到xampp服务器。我从php脚本中收到以下错误:
/<br /><b>Warning</b>: move_uploaded_file(uploads/null): failed to open stream: Permission denied in <b>D:\xampp\htdocs\uploadfile.php</b> on line <b>42</b><br /><br /><b>Warning</b>: move_uploaded_file(): Unable to move 'D:\xampp\tmp\phpE89E.tmp' to 'uploads/null' in <b>D:\xampp\htdocs\uploadfile.php</b> on line <b>42</b><br />There was an error uploading the file, please try again!filename: nulltarget_path: uploads/null
下面是我的php脚本:
<?php
// Where the file is going to be placed
$target_path = "uploads/";
/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
chmod ("uploads/".basename( $_FILES['uploadedfile']['name']), 755);
} else{
echo "There was an error uploading the file, please try again!";
echo "filename: " . basename( $_FILES['uploadedfile']['name']);
echo "target_path: " .$target_path;
}
?>
此外,结果显示文件名为&#34; null&#34;。任何人都可以告诉我这是什么原因。请帮我解决这个问题。
欢迎所有建议。提前谢谢。