1

Please help image cannot upload in server, my php code:-

    $gallery_image = $_FILES['image'] ['name'];
    $image_tmp = $_FILES['image'] ['tmp_name'];
    move_uploaded_file($image_tmp, "../extra_images/$gallery_image");

my error is:-

PHP Warning:  move_uploaded_file(../extra_images/brand-04.jpg): failed to open stream: Permission denied in G:\PleskVhosts\luisant.in\vethathirimaharishischool.org\admin\gallery.php on line 129
PHP Warning:  move_uploaded_file(): Unable to move 'C:\Windows\Temp\php4118.tmp' to '../extra_images/brand-04.jpg' in G:\PleskVhosts\luisant.in\vethathirimaharishischool.org\admin\gallery.php on line 129
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345

3 Answers3

0

The error is self explanatory:

failed to open stream: Permission denied on "../extra_images/"

you don't have the write permission on the above listed directory. Provide the write permission and try again.

Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59
0

You dont have permission to the directory.

To change the owner and permission of the destination directory which is /extra_images

Try this command:

  1. chown user /extra_images
  2. chmod 755 /extra_images
Joseph
  • 653
  • 1
  • 12
  • 28
0

This is because images and tmp_file_upload are only writable by root user. For upload to work we need to make the owner of those folders same as httpd process owner OR make them globally writable..learn more>>

Rashed Hasan
  • 3,721
  • 11
  • 40
  • 82