From: michaelchikit at gmail dot com Operating system: Fedora 3 PHP version: 5.0.2 PHP Bug Type: Filesystem function related Bug description: Upload permission error
Description: ------------ I have tried this code in my old server that is working very fine. But after I upgraded my server into Fedora 3 and PHP 5.0.2. that generated the followings error. The server does not allow me to upload the file and say permission denied. But I am very very sure, I have set the correct permission with the dir. The mode of upload_files and its parenet dir are 0777. Is it a bug of PHP? Reproduce code: --------------- $temp_name = $_FILES['userfile']['tmp_name']; $file_name = $_FILES['userfile']['name']; $file_type = $_FILES['userfile']['type']; $file_size = $_FILES['userfile']['size']; $result = $_FILES['userfile']['error']; $file_url = $upload_url.$file_name; $file_path = $upload_dir.$file_name; //File Name Check if ( $file_name =="") { $message = "Invalid File Name Specified"; return $message; } $result = move_uploaded_file($temp_name, $file_path); Expected result: ---------------- No Error , the file should be appeared in the dir Actual result: -------------- Warning: move_uploaded_file(upload_files/Sunset.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/html/simple_upload.php on line 47 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpO1zvJO' to 'upload_files/Sunset.jpg' in /var/www/html/simple_upload.php on line 47 Somthing is wrong with uploading a file. -- Edit bug report at http://bugs.php.net/?id=30858&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30858&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30858&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30858&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30858&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30858&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30858&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30858&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30858&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30858&r=support Expected behavior: http://bugs.php.net/fix.php?id=30858&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30858&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30858&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30858&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30858&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30858&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30858&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30858&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30858&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30858&r=mysqlcfg