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
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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.