tags:

views:

172

answers:

1

I am using this upload script here: http://www.webcheatsheet.com/php/file%5Fupload.php

It is working in server 1 but not server 2

This is server 1 http://bit.ly/Cf3bm

This is server 2 http://bit.ly/1LZMRY

Anyone knows why? Thanks

+1  A: 

You need to set permissions correctly on the second server. The actual upload is succeeding, but it's not able to copy the file to the directory you're trying to put it in.

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/usr/tmp/phprPH6xW' to '/usr/www/users/morganf/slideshows/testupload/upload/blah.jpg' in /usr/www/users/morganf/slideshows/testupload/upload.php on line 28

You can fix in any of the following ways:

Most secure way

cd /usr/www/users/morganf/slideshows/testupload/
chgrp www-data ./upload
chmod g+w ./upload

Note: This assumes that "www-data" is the apache user.

If you can't chgrp it to the Apache user, the command below would do the trick as well.

chmod 777 /usr/www/users/morganf/slideshows/testupload/upload/

Note: This means any user on the server can access these files.

Mike