I have selected multiple image and show the preview in a div box. When I click on Save button, I want to get the information of the image using loop in PHP.
I try to echo the image_path for testing purpose, but it show nothing output.
HTML Form
<form id="photo-event-form" name="event-photo-gallery-form" class="form-horizontal" method="post" role="form" enctype="multipart/form-data">
<fieldset>
<div class="control-group">
<label class="control-label" for="event_date">Event Photo</label>
<div class="controls">
: <input type="file" class="span3" id="pg_album" name="pg_album" multiple />
<div id="form_button_div" class="form_button_div">
<button id="test" name="pg_Save" type="submit" class="btn btn-primary">Save</button>
<button class="btn">Cancel</button>
</div>
</fieldset>
</form>
PHP Save submit
if (isset($_POST['pg_Save'])) {
$image_path = $_FILES['pg_album'];
$i = 0;
foreach ($Contents as $image_path) {
$i++;
echo $image_path; //display image file path
}
}
?>