Array ( [uploadedfile] => Array ( [name] => flashlog.txt [type] =>
text/plain [tmp_name] => /tmp/php0XYQgd [error] => 0 [size] => 3334 ) )
我正在使用一份基础的HTML/PHP教程,这让我认为这可能是一个服务器问题。我检查了php.ini文件,其中upload_max_filesize:2M,post_max_size:8M。所以我真的很困惑,因为我认为0的错误告诉我它已经成功了。
我使用的代码是:
<?php
// Where the file is going to be placed
$target_path = 'Test/';
$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";
}
else
{
echo "There was an error uploading the file, please try again!";
echo print_r($_FILES);
}
?>
move_uploaded_file
应该会发出警告,告诉你出了什么问题。 - deceze