I"m looking forward to upload two or more certificates images from user and store in mysql in row. How can I do that...
Here is the code I"m using to upload single image...but How can I modify the code to allow to store two images
My addstudent.php file has
<span>Name : </span><input type="text" style="width:265px; height:30px;" name="name" Required /><br>
<span>Cover Letter:</span><input type="file" name="file" id="file" required ><br><br>
and my SaveStudent.php contains
<?php
session_start();
include('../connect.php');
$a = $_POST['name'];
// query
$file_name = strtolower($_FILES['file']['name']);
$file_ext = substr($file_name, strrpos($file_name, '.'));
$prefix = 'your_site_name_'.md5(time()*rand(1, 9999));
$file_name_new = $prefix.$file_ext;
$path = '../uploads/'.$file_name_new;
/* check if the file uploaded successfully */
if(@move_uploaded_file($_FILES['file']['tmp_name'], $path)) {
//do your write to the database filename and other details
$sql = "INSERT INTO student (name,file) VALUES (:a,h)";
$q = $db->prepare($sql);
$q->execute(array(':a'=>$a,':h'=>$file_name_new));
header("location: students.php");
}
?>
Now how can I add one or more input to upload images as above in addstudent.php and savestudent.php.