Test upload image 2

This commit is contained in:
nox 2019-10-14 02:04:47 +02:00
parent fa4f4ae82d
commit 6e1a0110f7
1 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,7 @@ $path = str_replace('\\', '/', dirname(realpath(__DIR__)));
$location = $path.'/uploads/products/'.$filename;
$location2 = '/uploads/products/'.$filename;
echo "location = ".$location;
die();
// file extension
$file_extension = pathinfo($location, PATHINFO_EXTENSION);
$file_extension = strtolower($file_extension);
@ -19,6 +19,8 @@ $image_ext = array("jpg","png","jpeg");
$response = 0;
if(in_array($file_extension,$image_ext)){
// Upload du fichier
echo "<br />files image= ".$_FILES['image']['tmp_name'];
die();
if(move_uploaded_file($_FILES['image']['tmp_name'] ?? $_FILES['add_image']['tmp_name'],$location)){
$response = $location2;
}