Japheth Posted May 28, 2008 Share Posted May 28, 2008 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! Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 28, 2008 Share Posted May 28, 2008 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. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 28, 2008 Share Posted May 28, 2008 Turn on full php error reporting to get php to help you with any detectable errors it finds. Add the following two lines after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
Japheth Posted May 28, 2008 Author Share Posted May 28, 2008 Putting those two lines in revealed that the problem was indeed permissions and a simple chmod of the destination made everything work correctly. Thanks to both of you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.