0

i am using a form to upload images with the name of thier product ID and it works perfectly on my localhost but when i try to add or update a product throu my hosted site the image upload does't get uploaded, the code working on localhost is :

if(isset($_POST['variete']) === true)
{  
    $newname  =  $id.".jpg";
    $location = '/img/products_img/';
    move_uploaded_file($_FILES['img']['tmp_name'],$location.$newname);
}
G.Y
  • 6,042
  • 2
  • 37
  • 54

2 Answers2

0

you can add following code to the top of your script in orderd to see errors

error_reporting(-1);
ini_set('display_errors', true);

also make sure, you set the enctype of form to 'multipart/form-data'

Paul Kotets
  • 199
  • 5
0

It might be due to permission problem

set permission as 0755 to folder '/img/products_img/'

run the following command in server

chmod 755 /img/products_img/

vimal1083
  • 8,499
  • 6
  • 34
  • 50