{ currently, all the samples I have seen so far are mainly for a single file upload. thank you in advance. i'm a student and this is my first task. I would equally love to download or save the files from data base back to my computer. I wrote the code in php and sql, my problem is that each time i try uploading the files to xampp free database,I keep on receiving one file instead of two files in my folder I really need a professional way to do it and avoid users from submitting the same file twice. Thanks.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="post.php" method="POST" enctype="multipart/form-data">
<input type="file" class="videofile" name="videofile">
<input type="file" class="picturefile" name="picturefile">
<input type="submit" class="submit" name="submit">
</form>
</body>
</html>
MYSQL
CREATE TABLE userstable(id int(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
VARCHAR (200) NOT NULL,
videofile VARCHAR (200) NOT NULL,
picturefile VARCHAR (200) NOT NULL,
<?php
include "connect.php";
if(isset($_POST['submit'])){
$videofile = $_FILES['vfile']['name'];
$picturefile = $_FILES['pfile']['name'];
$folder = "uploads/";
if ($videofile == "" || $picturefile == ""){
echo "Sorry, your file was not uploaded, ensure all filed are filed.";
}
else{
move_uploaded_file($folder.$videofile, folder.$picturefile);
mysqli_query ($user, "INSERT INTO usertable(videofile, picturefile) VALUES('$videofile', '$picturefile')");
echo "Registration successful!";
}
}
?> }