Jump to content

[SOLVED] move_uploaded_file problem


Japheth

Recommended Posts

Basically, move_uploaded file returns false, but the error code is 0.

 

I have confirmed that the uploaded file is being copied to /tmp because I can read data from it with fopen and fread. The reason I want to use move_uploaded_file is so I can store it and access it later on.

 

Furthermore, I tried changing the default tmp directory to the document root (/var/www/html) and phpinfo() correctly reflects the changes, but $_FILES['datafile']['tmp_name'] still returns /tmp/longTempName

 

I also tried changing the permissions of the temp file to 777 (I think it was 600 when it was first downloaded) and I successfully changed them, but I still couldn't copy the file.

 

phpinfo() says that my php build is not a debug build. Does this mean there's no way to get error messages from php without rebuilding it? (I installed php from a package) The reason I'm asking is because the error messages might shed some more light on my problem.

 

Fedora Core 7, PHP 5.2.6, Apache, SAFE_MODE = Off

 

I have root access to the machine.

 

Any help would be greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/107644-solved-move_uploaded_file-problem/
Share on other sites

The PHP manual says that move_uploaded_file() will issue a warning with some more info when the file can't be moved.  I think you're on the right track in thinking it's a permissions problem, probably of the directory where you are trying to write it, although you didn't provide your code snippet, and you could have a problem with your destination file path.

 

Are you running php as fastcgi or as mod_php?  If mod_php then the user that needs the permissions to rw to the destination directory is the user that apache runs as.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.