I am new to php. I want to know how to change single image upload php to multi image upload.
Below is my code:-
<?php
require_once("header.php");
require_once("nav.php");
// Count total files
$countfiles = count($_FILES['files']['name']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frm_add_channel")) {
if(isset($_FILES['image']['tmp_name']))
{
$file = $_FILES['image']['tmp_name'];
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
move_uploaded_file($_FILES['image']['tmp_name'],"images/album" . $_FILES['image']['name']);
$albumid = $_POST['albumid'];
$name = str_replace("'","''",$name);
$place = $_POST['place'];
$place = str_replace("'","''",$place);
$owner = $_POST['owner'];
$type = $_POST['type'];
$path = $_FILES['image']['name'];
$sql = "INSERT INTO images (name,image,sys_album_id)
VALUES ('$path','$name','$albumid')";
$result = mysql_query($sql);
//$int_id = mysql_num_rows($result);
$int_id = mysql_num_rows();
echo '<script type="text/javascript">alert("Successfully Add New Channel!");location.href="gallery_upload.php";</script>';
}
}
?>
<br><br><br><br><br><br><br>
<?php echo $_GET['id'];?>
<form name="frm_add_channel" method="post" action='' enctype='multipart/form-data'>
<h4>Image (Less Than 2MB)</h4>
<img src="upload/qm.jpg" id="imgAvatar" alt="Course Image" />
<p><input type="file" name="image" id="image" onChange="showPreview(this)" accept="image/*" multiple /></p><br>
<input type="text" class="form" name="albumid" value"<?php echo $_GET['id'];?>" size="30" />
<p><input type="submit" value="Add Album" onclick="return checking()" /></p><br>
<input type="hidden" name="MM_insert" value="frm_add_channel">
</form>