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);
}
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'
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.