Page 1 of 1

move_uploaded_file problem...

Posted: Wed Dec 22, 2004 3:01 pm
by bg
I had code that worked under windows/apache2/php5, gentoo linux/apache2/php5, now im running it under freebsd 5.3/apache2/php5.

I get the error
Warning: move_uploaded_file(/usr/local/www/xxxxxx/script/temp/galleries/X4zV7eJ1j.zip) [function.move-uploaded-file]: failed to open stream: Permission denied in /usr/local/www/xxxxxx/script/admin/add_gallery.php on line 118

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/php6KQ2pb' to '/usr/local/www/xxxxxx/script/temp/galleries/X4zV7eJ1j.zip' in /usr/local/www/xxxxxx/script/admin/add_gallery.php on line 118
The var/tmp folder is chmodded 777, as well as the destination directory. Ive double checked the destination directory, even hard coded it, and still no luck. Any idea whats going on?

Posted: Wed Dec 22, 2004 3:22 pm
by rehfeld
is safemode on?
if so, the owner of that directory needs to be the same uid as whatever php runs as.

Posted: Wed Dec 22, 2004 3:28 pm
by bg
rehfeld wrote:is safemode on?
if so, the owner of that directory needs to be the same uid as whatever php runs as.
nope, safe mode is off per phpinfo();

Posted: Wed Dec 22, 2004 3:44 pm
by neophyte
Tough problem...

Have you tried using...

Code: Select all

<?php

exec("mv /file/temp_name /file/file/file/templ_name");

?>
Instead of move_uploaded_file();?

Posted: Wed Dec 22, 2004 4:21 pm
by bg
neophyte wrote:Tough problem...

Have you tried using...

Code: Select all

<?php

exec("mv /file/temp_name /file/file/file/templ_name");

?>
Instead of move_uploaded_file();?
doesnt work either, and doesnt produce any output. I'm completely lost :evil:

Posted: Wed Dec 22, 2004 4:25 pm
by Joe
Try uploading to usr/local/www/xxxxxx/script/temp/galleries/. Forget var/tmp for now. Also, would you be able to post this code for me to look over.

Posted: Wed Dec 22, 2004 4:29 pm
by rehfeld
can you write to the destination directory from php? try making a dummy file w/ fopen() to see if php can.

Posted: Mon Dec 27, 2004 11:01 am
by bg
chowned the destinaton directory to www:www and it worked. It was chmodded 777, and php isnt running in safe mode, but thats what it took. wierd.