MarkT Posted April 2, 2014 Share Posted April 2, 2014 Hello, I currently have the following code; <?PHP require "./system/connect.php" ?><?php if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";$filename = $_FILES["file"]["name"];$title = $_POST['name'];$publisher = $_POST['author'];mysqli_query($con,"INSERT INTO gallery (name,photo,author) VALUES ('{$title}','{$filename}','{$publisher}')");echo "<meta http-equiv='refresh' content='1; url=newgallery.php' />"; if (file_exists("gallery/album/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "gallery/album/" . $_FILES["file"]["name"]); echo "Stored in: " . "gallery/album/" . $_FILES["file"]["name"]; } }?> However, I would like the form to have 2 files to be uploaded, how would I embed it? Link to comment Share on other sites More sharing options...
thescientist Posted April 2, 2014 Share Posted April 2, 2014 add more input elements and loop through $_FILES instead. there are numerous tutorials online as well https://www.google.com/search?q=multiple+file+upload+php&oq=multiple+file+upload+php&aqs=chrome..69i57j0l5.6287j0j7&sourceid=chrome&espv=2&es_sm=119&ie=UTF-8 Link to comment Share on other sites More sharing options...
justsomeguy Posted April 2, 2014 Share Posted April 2, 2014 http://www.php.net/manual/en/features.file-upload.multiple.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now