0

I have photo upload on my site and it is working well when I was testing it on localhost. This is how and where the photo I uploaded on my localhost:

if($_FILES['file']['error'][$key] == 0 && 
   move_uploaded_file($_FILES['file']['tmp_name'][$key], 
                      "../gallery/{$gallery_images}"
                     )
   ){
....
}

But when I tried this on a webserver, it started showing errors. These are the errors:

Warning: move_uploaded_file(../gallery/289228065.jpg): failed to open stream: Permission denied in /var/www/alumni/admin/create_album.php on line 51 

Warning: move_uploaded_file(): Unable to move '/tmp/php3hJjHL' to '../gallery/289228065.jpg' in /var/www/alumni/admin/create_album.php on line 51

Warning: move_uploaded_file(../gallery/2001593678.jpg): failed to open stream: Permission denied in /var/www/alumni/admin/create_album.php on line 51 

Warning: move_uploaded_file(): Unable to move '/tmp/phpDiNyPg' to '../gallery/2001593678.jpg' in /var/www/alumni/admin/create_album.php on line 51

What should I do? I tried change the path but the same errors show up.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Felix
  • 85
  • 1
  • 10
  • 2
    seems like a permission error :)) – gavgrif Apr 16 '16 at 17:03
  • what should i do then? sorry, it's my first time to have it on webserver. @gavgrif – Felix Apr 16 '16 at 17:05
  • 1
    Possible duplicate of [move\_uploaded\_file gives "failed to open stream: Permission denied " error after all configurations i did](http://stackoverflow.com/questions/8103860/move-uploaded-file-gives-failed-to-open-stream-permission-denied-error-after) – Jose Rojas Apr 16 '16 at 17:06
  • http://stackoverflow.com/a/8104498/4357238 – Edward Apr 16 '16 at 18:08

0 Answers0