I have this script that is receiving data from a vue js client
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");
$image = '';
if(isset($_FILES['property_files']['name']))
{
$image_name = $_FILES['property_files']['name'];
$valid_extensions = array("jpg","jpeg","png");
$extension = pathinfo($image_name, PATHINFO_EXTENSION);
if(in_array($extension, $valid_extensions))
{
$upload_path = 'uploads/' . time() . '.' . $extension;
if(move_uploaded_file($_FILES['property_files']['tmp_name'], $upload_path))
{
$message = 'Image Uploaded';
$image = $upload_path;
}
else
{
$message = 'There is an error while uploading image';
}
}
else
{
$message = 'Only .jpg, .jpeg and .png Image allowed to upload';
}
}
else
{
$message = 'Select Image';
}
$output = array(
'url' => $image
);
echo json_encode($output);
I want the final output to be
[{
"url": "/absolute/path/to/filename.png"
}]
So far when i upload one image it works but more than one image, the script only uploads one image and for subsequent images it only echos duplicate image paths. How can i make the script upload multiple images?.