File upload problem: unable to move with move_uploaded_file
Posted: Mon May 14, 2007 5:08 am
Hello,
I am trying to upload files to a linux/apache/php box. My upload script works intermittently, failing more often than succeeding. The file upload process seems to go fine, with the error code in $_FILES reporting '0', and the filesize listed as correct.
Calling is_uploaded_file on the temp name of the file reports true. However, if I try moving the file using move_uploaded_file to the target directory, move_uploaded_file often issues the warning "unable to move xxx to yyy".
The directory permissions for both the temp directory and the target directory are set to 777, PHP's safe mode is off, and I believe the directories are both chowned to the apache/php user (and no, I'm not telling you where this box is!!).
The file does not seem to appear the temporary directory after move_uploaded_file has failed, which I would have expected it to have since move_uploaded_file claims to do nothing on failure. But I don't know enough about linux to know if the temp file would remain after the PHP upload script terminates.
So, any light y'all could shed on this would be greatly appreciated.
Cheers!
I am trying to upload files to a linux/apache/php box. My upload script works intermittently, failing more often than succeeding. The file upload process seems to go fine, with the error code in $_FILES reporting '0', and the filesize listed as correct.
Calling is_uploaded_file on the temp name of the file reports true. However, if I try moving the file using move_uploaded_file to the target directory, move_uploaded_file often issues the warning "unable to move xxx to yyy".
The directory permissions for both the temp directory and the target directory are set to 777, PHP's safe mode is off, and I believe the directories are both chowned to the apache/php user (and no, I'm not telling you where this box is!!).
The file does not seem to appear the temporary directory after move_uploaded_file has failed, which I would have expected it to have since move_uploaded_file claims to do nothing on failure. But I don't know enough about linux to know if the temp file would remain after the PHP upload script terminates.
So, any light y'all could shed on this would be greatly appreciated.
Cheers!