ID: 30858
Updated by: [EMAIL PROTECTED]
Reported By: michaelchikit at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Fedora 3
PHP Version: 5.0.2
New Comment:
Why do you think it's a bug in PHP and how can we reproduce it?
Previous Comments:
------------------------------------------------------------------------
[2004-11-26 01:11:42] michaelchikit at gmail dot com
I tried to use abd path.
This is not working
------------------------------------------------------------------------
[2004-11-25 23:10:27] [EMAIL PROTECTED]
Try it using absolute path for destination file.
------------------------------------------------------------------------
[2004-11-22 06:02:13] michaelchikit at gmail dot com
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 this bug report at http://bugs.php.net/?id=30858&edit=1