I got problem to set file name when uploading the image using multiple input file.
<span class="btn btn-default btn-file">
Browse <input type="file" name="image[]" id="image" class="image" onchange="preview_image();" multiple/>
</span>
And here is the PHP:
$total = count($_FILES['image']['name']);
for($i=0; $i<$total; $i++)
{
$tmpFilePath = $_FILES['image']['tmp_name'][$i];
if($tmpFilePath != "")
{
$info1 = pathinfo($_FILES['image']['name'][$i]);
$ext = $info1['extension'];
$newname1 = "CALIBRATION_.".$ext;
$newFilePath = "../assets/img/product/" . $newname1[$i];
if(move_uploaded_file($tmpFilePath, $newFilePath)){}
}
}
When I try to run the code, it show me wrong name & type. You can see below screenshot.
What I want is to rename the file after uploaded with correct name and file type.