PHP move_uploaded_file() issue

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!

Moderator: General Moderators

Post Reply
jon23d
Forum Newbie
Posts: 10
Joined: Wed Jun 07, 2006 3:47 am

PHP move_uploaded_file() issue

Post by jon23d »

I hope I'm posting this in the right place as I can't seem to find the right forum! I have some code that takes an uploaded file (on my local system) and is supposed to move it to another directory. The default temp directory (which is fine by me) is /tmp.

I have changed the webroot (/var/www/html) to be owned by the group 'webmasters'. I'm wondering if this is why I PHP cannot move temp files from /tmp to /var/www/html/images...

When I use move_uploaded_file to just rename it and move to /tmp everything is fine. This is why I wonder if it is a user-level issue. I'm rather new to linux and cannot find under which user php is running. Do I need to add this user to the webmasters group? When I try to get an error a null string is returned....

Thanks!
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Might want to check the destination directory permissions - make sure they are set at "rwxrwxrwx" or 777,
and then rename the file after moving it since those pernissions will allow you to do so.
Post Reply