I'm sure I'm not the first person to ask about this error, but I'm stumped even after following every tip I could find. At one point, I had file uploads working. Nobody used the function for several months, and today I found out it was broken. The only thing I can think might have broken it would be that I moved the folder location. But so far, that has been a dead-end for me. Folder permissions are 777 on the server, and I was able to copy a file to the folder over FTP.
The errors:
Warning: move_uploaded_file(inet/www/uploads/2c53db608b76dd1bc6fbf817c7c77492): failed to open stream: No such file or directory in /inet/www/confirm.php on line 49
Warning: move_uploaded_file(): Unable to move '/tmp/phpIt58oU' to 'inet/www/uploads/2c53db608b76dd1bc6fbf817c7c77492' in /inet/www/confirm.php on line 49
The code (after verifying existence of /tmp file, size, and mime type):
// Set upload folder path...
$uploadpath = "inet/www/uploads/";
// Get temp file name (set by php)...
$tmpname = $_FILES["file"]["tmp_name"];
// Get original file name...
$filename = $_FILES["file"]["name"];
// Create encrypted file name for more secure storage...
$hashname = hash_this($filename);
// Set full file storage path...
$fullpath = $uploadpath.$hashname;
// Move the file from the temp folder to the upload folder
if(move_uploaded_file($_FILES["file"]["tmp_name"], $fullpath) > 0)
{
// Error moving file...
$_SESSION['errmsg'] = "Unknown problem uploading file.";
}
PHP info:
file_uploads On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
upload_tmp_dir /tmp /tmp
upload_max_filesize 2M 2M
APACHE info:
System Linux intranet01 2.6.4-52-smp #1 SMP Wed Apr 7 02:11:20 UTC 2004 i686
Apache Version Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e