cle13 Posted October 6, 2006 Share Posted October 6, 2006 Hi guys, I have a multiple file upload script that doesn't work properly. Its supposed to upload two files to two different directories but it only uploads one! Can someone help me please? The code is below thanx.[code]<?php //This is the directory where images will be saved $target1 = "publications1/";$target2 = "publications2/";$target1 = $target1 . basename( $_FILES['book_image1']['name']);$target2 = $target2 . basename( $_FILES['book_image2']['name']); //This gets all the other information from the form $title=$_POST['title'];$author=$_POST['author'];$DOP=$_POST['DOP'];$theme=$_POST['theme'];$abstract=$_POST['abstract'];$book_image1=($_FILES['book_image1']['name']);$book_image2=($_FILES['book_image2']['name']);$status=$_POST['status'];$category=$_POST['category'];$sub_category=$_POST['sub_category'];$link=$_POST['link'];// Connects to your Database mysql_connect("localhost", "cle", "pass") or die(mysql_error()); mysql_select_db("ipra") or die(mysql_error()); //Writes the information to the database mysql_query("INSERT INTO `publications` (title, author, DOP, theme, abstract, book_image1, book_image2, status, category, sub_category, link) VALUES ('$title', '$author', '$DOP', '$theme', '$abstract', '$book_image1', '$book_image2', '$status', '$category', '$sub_category', '$link')"); //Writes the photo to the server $task1=move_uploaded_file($_FILES['book_image1']['tmp_name'], $target1);$task2=move_uploaded_file($_FILES['book_image2']['tmp_name'], $target2);if($task1 && $task2){//Tells you if its all ok echo "The Publication was Uploaded Successfully! <br> ";header("location:publist.php"); } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>[/code]Thanx Quote Link to comment https://forums.phpfreaks.com/topic/23147-multiple-file-upload/ Share on other sites More sharing options...
Daniel0 Posted October 6, 2006 Share Posted October 6, 2006 Could we see the form? Quote Link to comment https://forums.phpfreaks.com/topic/23147-multiple-file-upload/#findComment-104807 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.