Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
file upload script problem
I have a file submitted to the server but it isn't moving. I hope you can explain why the file might not be moving.
It seems to be uploaded to the server successfully because the file's error code is 0.
The file isn't moving from its temperary location to a new one, though.
The move_uploaded_file function is returning false(indicating that it failed to move the temperary file).
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
echo "target path is $target_path";
$f = $_FILES['uploadedfile']['tmp_name'];
echo "file is $f<br />";
$response = move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded
echo "There was an error uploading the file, please try again!
$e = $_FILES["uploadedfile"]["error"];
echo "error code: $e
output from script after submitting a short simple file:
target path is uploads/info.txtfile is /tmp/php4sZB7g
There was an error uploading the file, please try again!
error code: 0
My first guess was that the server was configured improperly for file uploads. Someone in charge of administering the server said the server is configured properly for file uploads with PHP, though. Do you have other ideas?
0 · ·