|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-11-25 23:10 UTC] tony2001@php.net
[2004-11-26 01:11 UTC] michaelchikit at gmail dot com
[2004-11-27 09:28 UTC] tony2001@php.net
[2004-11-29 00:27 UTC] michaelchikit at gmail dot com
[2004-11-29 08:25 UTC] tony2001@php.net
[2005-01-04 06:16 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 23 19:00:01 2025 UTC |
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.