PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am trying to setup a simple file upload script and its not working for some reason that I cannot figure out. I have /mnt/tmp setup as the temp directory and I want to upload a file to the server and store it there so I can look at it later. However, when I upload a file to the server nothing appears in the folder. Permissions on /mnt/tmp are 777. I am running php5 on Ubuntu.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
When I turn on error reporting I get the error "Warning: move_uploaded_file(upload/Test.txt): failed to open stream: Permission denied in /mnt/sites/admin.jon-hacker.com/docs/file_upload.php on line 22 Warning: move_uploaded_file(): Unable to move '/mnt/tmp/phpmoNeTl' to 'upload/Test.txt' in /mnt/sites/admin.jon-hacker.com/docs/file_upload.php on line 22"
When I comment out the move_uploaded_file() portion of the script, nothing is created in /mnt/tmp either. I am thinking its a server config issue but just not sure what to check.
I figured it out. I had created the /mnt/tmp directory as root so the owner:group of the folder was root:root. Since I was executing the script as a lower user, even with the chmod 777 on the folder the script could not write to it. A simple chown web:web /mnt/tmp fixed the issue. Thanks for all your help.