Imrie Posted August 8, 2007 Share Posted August 8, 2007 Ok, i have been working on this for days. I am cutomizing a script from about.com. Ok This is basically what it was: Form: <form enctype="multipart/form-data" action="script.php" method="POST"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name = "email"><br> Phone: <input type="text" name = "phone"><br> Photo: <input type="file" name="photo"><br> <input type="submit" value="Add"> </form> Script: <?php //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `TABLE` VALUES ('$name', '$email', '$phone', '$pic')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> I need to have 2 uploads at the same time. The files go into a directory and the URLs and other info go into a table in a database. The table is determined by the option value of a dropdown menu. I need the following this helped: Adding the seconed upload in. Fixing an error. Heres what i got: <form enctype="multipart/form-data" action="script.php" method="POST"> Name: <input type="text" name="title"><br> E-mail: <input type="text" name = "author"><br> Phone: <input type="text" name = "phone"><br> Photo: <input type="file" name="photo"><br> Category: <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select> <input type="submit" value="Add"> </form> Script: <?php if($_SERVER['REQUEST_METHOD'] == "POST") { //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $title=$_POST['title']; $author=$_POST['author']; $Image_file=($_FILES['photo']['name']); // Connects to your Database mysql_connect("", "", "") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `" . $_POST['option'] . "` VALUES ('$title', '$author', '$Image_file')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } } ?> I got this when submit was pressed: Notice: Undefined index: option in /home/fhlinux164/m/mysimtractor.com/user/htdocs/script.php on line 21 The file has been uploaded, and your information has been added to the directory Argh its not going into the table because it dosent know what the object is meaning. Can someone fix it and add in the seconed upload. I dont need MAXFILESIZE etc. Thanks very much! Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/ Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Correction : The script doesent know what "option" is meaning Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318334 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 //Writes the information to the database mysql_query("INSERT INTO `" . $_POST['option'] . "` VALUES ('$title', '$author', '$Image_file')") ; the name of ur html select is 'options' Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318336 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Excellent! Thanks! now do you know how to upload 2 files at the same time? Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318338 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 I havent had first hand experience in uploading files in php...ve u referred the code at link http://www.phpfreaks.com/quickcode/Upload-Multiple-Files-Simple-Code/582.php Wat error r u getting? Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318339 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Its no error, thats solved thanks to you, its just i need to files to be uploaded and i dont know how, i tried...and failed. Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318341 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Ok, the code on :http://www.phpfreaks.com/quickcode/Upload-Multiple-Files-Simple-Code/582.php Would do the trick, if someone could add in the insert into database part, and the list of options. Its so complicated i dont know where to add it in. That code would be perfect. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318343 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 I tuk a piece of ur code and tried it..it workd fine.the pic was uploaded as well as the record was inserted with the filename. Whr do u ve problem...s ur file getting uploaded???or is d insertion not taking place??? Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318350 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 The problem now was going into the database, but now... Its using the code from the page:http://www.phpfreaks.com/quickcode/Upload-Multiple-Files-Simple-Code/582.php This code uploads it, but i need to add the insert into the database too. I Know how, i just dont know where to paste the code. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318358 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 I suggest you could do the database insertion first and then do the file upload.So if the upload turns out to be unsuccessful,u can delete tat particular record frm databse. You can place the db insertion code at #-----------------------------------------------------------# 92 # this function will upload the files. cool # 93 #-----------------------------------------------------------# 94 # #####INSERT DB CODE HERE ############ # if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) { 95 echo "File $i: ($file_name) Uploaded.<br>"; 96 }else{ 97 echo "File $i: Faild to upload.<br>"; 98 }#end of (move_uploaded_file). Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318362 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 I also need to know where to add the drop down menu in as well as a few more fields. Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318363 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 u can use ur form,just change the form action attribute to point to the new script file and change accordingly in the script where the $POST vars are being accessed. Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318370 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 But this script has the form "built in", i would prefer to use this. What i have so far: <?php ########################################### #----------Upload Multiple Files----------# #----------Multi-files Uploader-----------# #-------------Multi-Uploader -------------# ########################################### /*========================================= Author : Mohammed Ahmed(M@@king) Version : 1.0 Date Created: Aug 20 2005 ---------------------------- Last Update: Aug 31 2005 ---------------------------- Country : Palestine City : Gaza E-mail : m@maaking.com MSN : m@maaking.com AOL-IM : maa2pal WWW : http://www.maaking.com Mobile/SMS : 00972-599-622235 =========================================== ------------------------------------------*/ //Get data $name=$_POST['name']; $Author=$_POST['author']; //upload directory. //change to fit your need eg. files, upload .... etc. $upload_dir = "images/"; //number of files to upload. $num_files = 2; //the file size in bytes. $size_bytes =1151200; //51200 bytes = 50KB. //Extensions you want files uploaded limited to. $limitedext = array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe"); //check if the directory exists or not. if (!is_dir("$upload_dir")) { die ("Error: The directory <b>($upload_dir)</b> doesn't exist"); } //check if the directory is writable. if (!is_writeable("$upload_dir")){ die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)"); } //if the form has been submitted, then do the upload process //infact, if you clicked on (Upload Now!) button. if (isset($_POST['upload_form'])){ echo "<h3>Upload results:</h3>"; //do a loop for uploading files based on ($num_files) number of files. for ($i = 1; $i <= $num_files; $i++) { //define variables to hold the values. $new_file = $_FILES['file'.$i]; $file_name = $new_file['name']; //to remove spaces from file name we have to replace it with "_". $file_name = str_replace(' ', '_', $file_name); $file_tmp = $new_file['tmp_name']; $file_size = $new_file['size']; #-----------------------------------------------------------# # this code will check if the files was selected or not. # #-----------------------------------------------------------# if (!is_uploaded_file($file_tmp)) { //print error message and file number. echo "File $i: Not selected.<br>"; }else{ #-----------------------------------------------------------# # this code will check file extension # #-----------------------------------------------------------# $ext = strrchr($file_name,'.'); if (!in_array(strtolower($ext),$limitedext)) { echo "File $i: ($file_name) Wrong file extension. <br>"; }else{ #-----------------------------------------------------------# # this code will check file size is correct # #-----------------------------------------------------------# if ($file_size > $size_bytes){ echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>"; }else{ #-----------------------------------------------------------# # this code check if file is Already EXISTS. # #-----------------------------------------------------------# if(file_exists($upload_dir.$file_name)){ echo "File $i: ($file_name) already exists.<br>"; }else{ #-----------------------------------------------------------# # this function will upload the files. cool # #-----------------------------------------------------------# // Connects to your Database mysql_connect("", "", "") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database $query = "INSERT INTO `" . $_POST['options'] . "` (title, author, file_name, Image_file) VALUES ('$_POST[name]', '$_POST[author]')"; mysql_query($query); if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) { echo "File $i: ($file_name) Uploaded.<br>"; }else{ echo "File $i: Faild to upload.<br>"; }#end of (move_uploaded_file). }#end of (file_exists). }#end of (file_size). }#end of (limitedext). }#end of (!is_uploaded_file). }#end of (for loop). # print back button. echo "»<a href="$_SERVER[php_SELF]">back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. }else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 151024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type="file" name="file". $i .""><br>"; } echo " <input type="hidden" name="MAX_FILE_SIZE" value="$size_bytes"> <input type="submit" name="upload_form" value="Upload Now!"> </form>"; } //print copyright ;-) echo"<p align="right"><br>Script by: <a href="http://www.maaking.com">maaking.com</a></p>"; ?> The form is this part at this part: //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. }else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 151024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type="file" name="file". $i .""><br>"; } echo " <input type="hidden" name="MAX_FILE_SIZE" value="$size_bytes"> <input type="submit" name="upload_form" value="Upload Now!"> </form>"; I need to add these items to the form. 1: <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select> 2. Title: <input type="text" name = "Title"><br> Title: <input type="text" name="Author"><br> 3. And finally, In this code what is used to define the url the uploaded file, example: in my previous code it was '$_FILES[file][name]' I need this so i know how to insert it into the database. Thanks for your help so far, Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318378 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 For ur 1st query,u can place ur form elements Title: <input type="text" name = "Title"><br> Title: <input type="text" name="Author"><br> <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> ...... after Max file size = ". $size_bytes / 151024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; # ####UR FORM ELEMENTS HERE ###### # (place it widin an echo) For ur 2nd query,the filename for each of the uploaded files is stored in variable $file_name.chk out in $file_name = $new_file['name']; 56 //to remove spaces from file name we have to replace it with "_". 57 $file_name = str_replace(' ', '_', $file_name); Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318388 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 I did what you said, heres what i got: <?php ########################################### #----------Upload Multiple Files----------# #----------Multi-files Uploader-----------# #-------------Multi-Uploader -------------# ########################################### /*========================================= Author : Mohammed Ahmed(M@@king) \nVersion : 1.0 \nDate Created: Aug 20 2005 \n---------------------------- \nLast Update: Aug 31 2005 \n---------------------------- \nCountry : Palestine \nCity : Gaza \nE-mail : m@maaking.com \nMSN : m@maaking.com \nAOL-IM : maa2pal \nWWW : http://www.maaking.com \nMobile/SMS : 00972-599-622235 \n \n=========================================== ------------------------------------------*/ //Get data $name=$_POST['name']; $Author=$_POST['author']; //upload directory. //change to fit your need eg. files, upload .... etc. $upload_dir = "images/"; //number of files to upload. $num_files = 2; //the file size in bytes. $size_bytes =512000; //51200 bytes = 50KB. //Extensions you want files uploaded limited to. $limitedext = array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe"); //check if the directory exists or not. if (!is_dir("$upload_dir")) { die ("Error: The directory <b>($upload_dir)</b> doesn't exist"); } //check if the directory is writable. if (!is_writeable("$upload_dir")){ die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)"); } //if the form has been submitted, then do the upload process //infact, if you clicked on (Upload Now!) button. if (isset($_POST['upload_form'])){ echo "<h3>Upload results:</h3>"; //do a loop for uploading files based on ($num_files) number of files. for ($i = 1; $i <= $num_files; $i++) { //define variables to hold the values. $new_file = $_FILES['file'.$i]; $file_name = $new_file['name']; //to remove spaces from file name we have to replace it with "_". $file_name = str_replace(' ', '_', $file_name); $file_tmp = $new_file['tmp_name']; $file_size = $new_file['size']; #-----------------------------------------------------------# # this code will check if the files was selected or not. # #-----------------------------------------------------------# if (!is_uploaded_file($file_tmp)) { //print error message and file number. echo "File $i: Not selected.<br>"; }else{ #-----------------------------------------------------------# # this code will check file extension # #-----------------------------------------------------------# $ext = strrchr($file_name,'.'); if (!in_array(strtolower($ext),$limitedext)) { echo "File $i: ($file_name) Wrong file extension. <br>"; }else{ #-----------------------------------------------------------# # this code will check file size is correct # #-----------------------------------------------------------# if ($file_size > $size_bytes){ echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>"; }else{ #-----------------------------------------------------------# # this code check if file is Already EXISTS. # #-----------------------------------------------------------# if(file_exists($upload_dir.$file_name)){ echo "File $i: ($file_name) already exists.<br>"; }else{ #-----------------------------------------------------------# # this function will upload the files. cool # #-----------------------------------------------------------# // Connects to your Database mysql_connect("", "", "") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database $query = "INSERT INTO `" . $_POST['options'] . "` (title, author, file_name, Image_file) VALUES ('$_POST[name]', '$_POST[author]')"; mysql_query($query); if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) { echo "File $i: ($file_name) Uploaded.<br>"; }else{ echo "File $i: Faild to upload.<br>"; }#end of (move_uploaded_file). }#end of (file_exists). }#end of (file_size). }#end of (limitedext). }#end of (!is_uploaded_file). }#end of (for loop). # print back button. echo "»<a href="$_SERVER[php_SELF]">back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. }else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 1024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; echo "Title: <input type="text" name = "Title"><br> Title: <input type="text" name="Author"><br> <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select>"; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type="file" name="file". $i .""><br>"; } echo " <input type="hidden" name="MAX_FILE_SIZE" value="$size_bytes"> <input type="submit" name="upload_form" value="Upload Now!"> </form>"; } //print copyright ;-) echo"<p align="right"><br>Script by: <a href="http://www.maaking.com">maaking.com</a></p>"; ?> I didnt put the $file_name thing in tho. (dont understand). I got this error :"Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/fhlinux164/m/mysimtractor.com/user/htdocs/test.php on line 124" line 124 is: " <option value="Disc_Harrow">Disc_Harrow</option> " Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318398 Share on other sites More sharing options...
pranav_kavi Posted August 8, 2007 Share Posted August 8, 2007 u ll ve 2 escape double quotes tat appear in the html code using '\'. For eg,it wud be echo "Title: <input type=\"text\" name = \"Title\"><br> Also u cant ve each of the html statment in different lines in php.they have to b either concatenated using '.' or use different echo statments. Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318406 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 I still get the same error here: echo "»<a href="$_SERVER[php_SELF]">back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. }else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 151024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; echo " <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select>"; echo "Title: <input type=\"text\" name = \"Title\">"; echo "Title: <input type=\"text\" name=\"Author\">"; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type="file" name="file". $i .""><br>"; } echo " <input type="hidden" name="MAX_FILE_SIZE" value="$size_bytes"> <input type="submit" name="upload_form" value="Upload Now!"> </form>"; } //print copyright ;-) echo"<p align="right"><br>Script by: <a href="http://www.maaking.com">maaking.com</a></p>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318432 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Ok , i have now made some more changes, which should mean everything works and this is the last error, once that is solved it done: Full coding: <?php ########################################### #----------Upload Multiple Files----------# #----------Multi-files Uploader-----------# #-------------Multi-Uploader -------------# ########################################### /*========================================= Author : Mohammed Ahmed(M@@king) Version : 1.0 Date Created: Aug 20 2005 ---------------------------- Last Update: Aug 31 2005 ---------------------------- Country : Palestine City : Gaza E-mail : m@maaking.com MSN : m@maaking.com AOL-IM : maa2pal WWW : http://www.maaking.com Mobile/SMS : 00972-599-622235 =========================================== ------------------------------------------*/ if($_SERVER['REQUEST_METHOD'] == "POST") { //Get data $name=$_POST['name']; $Author=$_POST['author']; //upload directory. //change to fit your need eg. files, upload .... etc. $upload_dir = "images/"; //number of files to upload. $num_files = 2; //the file size in bytes. $size_bytes =1151200; //51200 bytes = 50KB. //Extensions you want files uploaded limited to. $limitedext = array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe"); //check if the directory exists or not. if (!is_dir("$upload_dir")) { die ("Error: The directory <b>($upload_dir)</b> doesn't exist"); } //check if the directory is writable. if (!is_writeable("$upload_dir")){ die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)"); } //if the form has been submitted, then do the upload process //infact, if you clicked on (Upload Now!) button. if (isset($_POST['upload_form'])){ echo "<h3>Upload results:</h3>"; //do a loop for uploading files based on ($num_files) number of files. for ($i = 1; $i <= $num_files; $i++) { //define variables to hold the values. $new_file = $_FILES['file'.$i]; $file_name = $new_file['name']; //to remove spaces from file name we have to replace it with "_". $file_name = str_replace(' ', '_', $file_name); $file_tmp = $new_file['tmp_name']; $file_size = $new_file['size']; #-----------------------------------------------------------# # this code will check if the files was selected or not. # #-----------------------------------------------------------# if (!is_uploaded_file($file_tmp)) { //print error message and file number. echo "File $i: Not selected.<br>"; }else{ #-----------------------------------------------------------# # this code will check file extension # #-----------------------------------------------------------# $ext = strrchr($file_name,'.'); if (!in_array(strtolower($ext),$limitedext)) { echo "File $i: ($file_name) Wrong file extension. <br>"; }else{ #-----------------------------------------------------------# # this code will check file size is correct # #-----------------------------------------------------------# if ($file_size > $size_bytes){ echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>"; }else{ #-----------------------------------------------------------# # this code check if file is Already EXISTS. # #-----------------------------------------------------------# if(file_exists($upload_dir.$file_name)){ echo "File $i: ($file_name) already exists.<br>"; }else{ #-----------------------------------------------------------# # this function will upload the files. cool # #-----------------------------------------------------------# // Connects to your Database mysql_connect("", "", "") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database $query = "INSERT INTO `" . $_POST['options'] . "` (title, author, file_name, Image_file) VALUES ('$_POST[title]', '$_POST[author]', '$_POST[$file_name]', '$_POST[$file_name]')"; mysql_query($query); if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) { echo "File $i: ($file_name) Uploaded.<br>"; }else{ echo "File $i: Faild to upload.<br>"; }#end of (move_uploaded_file). }#end of (file_exists). }#end of (file_size). }#end of (limitedext). }#end of (!is_uploaded_file). }#end of (for loop). # print back button. echo "»<a href="$_SERVER[php_SELF]">back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. }else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 151024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; echo " <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select>"; echo "Title: <input type=\"text\" name = \"Title\">"; echo "Title: <input type=\"text\" name=\"Author\">"; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type="file" name="file". $i .""><br>"; } echo " <input type="hidden" name="MAX_FILE_SIZE" value="$size_bytes"> <input type="submit" name="upload_form" value="Upload Now!"> </form>"; } } //print copyright ;-) echo"<p align="right"><br>Script by: <a href="http://www.maaking.com">maaking.com</a></p>"; ?> Final error: "Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/fhlinux164/m/mysimtractor.com/user/htdocs/test.php on line 128" LINE 128: }#end of (for loop). # print back button. 128: echo "»<a href="$_SERVER[php_SELF]">back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. }else{ echo " <h3>Select files to upload!.</h3> Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318470 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 still no progress... Tried deleting the line, then threw another error (same one) on line 135 which also contains php self. Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318497 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 BUMP, sorry i can t work this out what does the error mean? Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318577 Share on other sites More sharing options...
MadTechie Posted August 8, 2007 Share Posted August 8, 2007 replace echo "»<a href="$_SERVER[php_SELF]">back</a>"; with echo "»<a href='".$_SERVER[php_SELF]."'>back</a>"; or echo "»<a href='{$_SERVER[php_SELF]}'>back</a>"; Note the single quotes Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318583 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Parse error: syntax error, unexpected T_ELSE in /home/fhlinux164/m/mysimtractor.com/user/htdocs/test.php on line 131 Now its ^ at the else statment Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318587 Share on other sites More sharing options...
MadTechie Posted August 8, 2007 Share Posted August 8, 2007 can you post the compleate code Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318592 Share on other sites More sharing options...
Imrie Posted August 8, 2007 Author Share Posted August 8, 2007 Here: <?php ########################################### #----------Upload Multiple Files----------# #----------Multi-files Uploader-----------# #-------------Multi-Uploader -------------# ########################################### /*========================================= Author : Mohammed Ahmed(M@@king) Version : 1.0 Date Created: Aug 20 2005 ---------------------------- Last Update: Aug 31 2005 ---------------------------- Country : Palestine City : Gaza E-mail : m@maaking.com MSN : m@maaking.com AOL-IM : maa2pal WWW : http://www.maaking.com Mobile/SMS : 00972-599-622235 =========================================== ------------------------------------------*/ //Get data $name=$_POST['name']; $Author=$_POST['author']; //upload directory. //change to fit your need eg. files, upload .... etc. $upload_dir = "images/"; //number of files to upload. $num_files = 2; //the file size in bytes. $size_bytes =1151200; //51200 bytes = 50KB. //Extensions you want files uploaded limited to. $limitedext = array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe"); //check if the directory exists or not. if (!is_dir("$upload_dir")) { die ("Error: The directory <b>($upload_dir)</b> doesn't exist"); } //check if the directory is writable. if (!is_writeable("$upload_dir")){ die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)"); } //if the form has been submitted, then do the upload process //infact, if you clicked on (Upload Now!) button. if (isset($_POST['upload_form'])){ echo "<h3>Upload results:</h3>"; //do a loop for uploading files based on ($num_files) number of files. for ($i = 1; $i <= $num_files; $i++) { //define variables to hold the values. $new_file = $_FILES['file'.$i]; $file_name = $new_file['name']; //to remove spaces from file name we have to replace it with "_". $file_name = str_replace(' ', '_', $file_name); $file_tmp = $new_file['tmp_name']; $file_size = $new_file['size']; #-----------------------------------------------------------# # this code will check if the files was selected or not. # #-----------------------------------------------------------# if (!is_uploaded_file($file_tmp)) { //print error message and file number. echo "File $i: Not selected.<br>"; }else{ #-----------------------------------------------------------# # this code will check file extension # #-----------------------------------------------------------# $ext = strrchr($file_name,'.'); if (!in_array(strtolower($ext),$limitedext)) { echo "File $i: ($file_name) Wrong file extension. <br>"; }else{ #-----------------------------------------------------------# # this code will check file size is correct # #-----------------------------------------------------------# if ($file_size > $size_bytes){ echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>"; }else{ #-----------------------------------------------------------# # this code check if file is Already EXISTS. # #-----------------------------------------------------------# if(file_exists($upload_dir.$file_name)){ echo "File $i: ($file_name) already exists.<br>"; }else{ #-----------------------------------------------------------# # this function will upload the files. cool # #-----------------------------------------------------------# // Connects to your Database mysql_connect("", "imrieimag", "") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database $query = "INSERT INTO `" . $_POST['options'] . "` (title, author, file_name, Image_file) VALUES ('$_POST[title]', '$_POST[author]', '$_POST[$file_name]', '$_POST[$file_name]')"; mysql_query($query); if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) { echo "File $i: ($file_name) Uploaded.<br>"; }else{ echo "File $i: Faild to upload.<br>"; }#end of (move_uploaded_file). }#end of (file_exists). }#end of (file_size). }#end of (limitedext). }#end of (!is_uploaded_file). }#end of (for loop).; } echo "»<a href='".$_SERVER[php_SELF]."'>back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 151024 ." KB"; echo " <form method="post" action="$_SERVER[php_SELF]" enctype="multipart/form-data">"; echo " <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select>"; echo "Title: <input type="text" name = "Title">"; echo "Title: <input type="text" name="Author">"; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type="file" name="file". $i .""><br>"; } echo " <input type="hidden" name="MAX_FILE_SIZE" value="$size_bytes"> <input type="submit" name="upload_form" value="Upload Now!"> </form>"; } } //print copyright ;-) echo"<p align="right"><br>Script by: <a href="http://www.maaking.com">maaking.com</a></p>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318606 Share on other sites More sharing options...
MadTechie Posted August 8, 2007 Share Posted August 8, 2007 try this <?php ########################################### #----------Upload Multiple Files----------# #----------Multi-files Uploader-----------# #-------------Multi-Uploader -------------# ########################################### /*========================================= Author : Mohammed Ahmed(M@@king) Version : 1.0 Date Created: Aug 20 2005 ---------------------------- Last Update: Aug 31 2005 ---------------------------- Country : Palestine City : Gaza E-mail : m@maaking.com MSN : m@maaking.com AOL-IM : maa2pal WWW : http://www.maaking.com Mobile/SMS : 00972-599-622235 =========================================== ------------------------------------------*/ //Get data $name=$_POST['name']; $Author=$_POST['author']; //upload directory. //change to fit your need eg. files, upload .... etc. $upload_dir = "images/"; //number of files to upload. $num_files = 2; //the file size in bytes. $size_bytes =1151200; //51200 bytes = 50KB. //Extensions you want files uploaded limited to. $limitedext = array(".gif",".jpg",".jpeg",".png",".txt",".nfo",".doc",".rtf",".htm",".dmg",".zip",".rar",".gz",".exe"); //check if the directory exists or not. if (!is_dir("$upload_dir")) { die ("Error: The directory <b>($upload_dir)</b> doesn't exist"); } //check if the directory is writable. if (!is_writeable("$upload_dir")){ die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)"); } //if the form has been submitted, then do the upload process //infact, if you clicked on (Upload Now!) button. if (isset($_POST['upload_form'])){ echo "<h3>Upload results:</h3>"; //do a loop for uploading files based on ($num_files) number of files. for ($i = 1; $i <= $num_files; $i++) { //define variables to hold the values. $new_file = $_FILES['file'.$i]; $file_name = $new_file['name']; //to remove spaces from file name we have to replace it with "_". $file_name = str_replace(' ', '_', $file_name); $file_tmp = $new_file['tmp_name']; $file_size = $new_file['size']; #-----------------------------------------------------------# # this code will check if the files was selected or not. # #-----------------------------------------------------------# if (!is_uploaded_file($file_tmp)) { //print error message and file number. echo "File $i: Not selected.<br>"; }else{ #-----------------------------------------------------------# # this code will check file extension # #-----------------------------------------------------------# $ext = strrchr($file_name,'.'); if (!in_array(strtolower($ext),$limitedext)) { echo "File $i: ($file_name) Wrong file extension. <br>"; }else{ #-----------------------------------------------------------# # this code will check file size is correct # #-----------------------------------------------------------# if ($file_size > $size_bytes){ echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>"; }else{ #-----------------------------------------------------------# # this code check if file is Already EXISTS. # #-----------------------------------------------------------# if(file_exists($upload_dir.$file_name)){ echo "File $i: ($file_name) already exists.<br>"; }else{ #-----------------------------------------------------------# # this function will upload the files. cool # #-----------------------------------------------------------# // Connects to your Database mysql_connect("", "imrieimag", "") or die(mysql_error()) ; mysql_select_db("imrieimag") or die(mysql_error()) ; //Writes the information to the database $query = "INSERT INTO `".$_POST['options']."` (title, author, file_name, Image_file) VALUES ('".$_POST['title']."', '".$_POST['author']."', '".$_POST[$file_name]."', '".$_POST[$file_name]."')"; mysql_query($query); if (move_uploaded_file($file_tmp,$upload_dir.$file_name)) { echo "File $i: ($file_name) Uploaded.<br>"; }else{ echo "File $i: Faild to upload.<br>"; }#end of (move_uploaded_file). }#end of (file_exists). }#end of (file_size). }#end of (limitedext). }#end of (!is_uploaded_file). }#end of (for loop).; } echo "»<a href='".$_SERVER['PHP_SELF']."'>back</a>"; //////////////////////////////////////////////////////////////////////////////// //else if the form didn't submitted then show it. else{ echo " <h3>Select files to upload!.</h3> Max file size = ". $size_bytes / 151024 ." KB"; echo ' <form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data">'; echo ' <select name="options"> <option value="CLAAS_Cougar ">CLAAS_Cougar </option> <option value="CLAAS_Disco ">CLAAS_Disco </option> <option value="CLAAS_Round Baler ">CLAAS_Round Baler </option> <option value="CLAAS_Xerion">CLAAS_Xerion</option> <option value="Delvano_Sprayer">Delvano_Sprayer</option> <option value="Disc_Harrow">Disc_Harrow</option> <option value="Forage_Harvester ">Forage_Harvester </option> <option value="Grain_Cart">Grain_Cart</option <option value="Grain_Trailer">Grain_Trailer</option> <option value="Header_Trailer ">Header_Trailer </option> <option value="John_Deere_7810">John_Deere_7810</option> <option value="John_Deere_7920 ">John_Deere_7920 </option> <option value="John_Deere_8310">John_Deere_8310</option> <option value="John_Deere_8310t">John_Deere_8310 T </option> <option value="John_Deere_Corn_Header">John_Deere_Corn_Header </option> <option value="John_Deere_Corn_Seeder">John_Deere_Corn_Seeder</option> <option value="John_Deere_Front_Loader">John_Deere_Front_Loader </option> <option value="John_Deere_Machine_40">John_Deere_Machine_40 </option> <option value="John_Deere_Seeder">John_Deere_Seeder </option> <option value="John_Deere_Square_Baler">John_Deere_Square_Baler </option> <option value="John_Deere_STS">John_Deere_STS </option> <option value="John_Deere_Telehandler">John_Deere_Telehandler </option> <option value="John_Deere_Tiller">John_Deere_Tiller </option> <option value="Lexion">Lexion</option> <option value="Livestock_Trialer">Livestock_Trialer</option> <option value="Manure_spreader">Manure_spreader </option> <option value="Manure_Tanker">Manure_Tanker</option> <option value="Miscellaneous">Miscellaneous</option> <option value="New_Holland_NCR">New_Holland_NCR</option> <option value="New_Holland_TG">New_Holland_TG </option> <option value="Plough">Plough</option> <option value="Truck">Truck</option> </select>'; echo 'Title: <input type="text" name = "Title">'; echo 'Title: <input type="text" name="Author">'; // show the file input field based on($num_files). for ($i = 1; $i <= $num_files; $i++) { echo "File $i: <input type='file' name='file".$i."'><br>"; } echo " <input type='hidden' name='MAX_FILE_SIZE' value='$size_bytes'> <input type='submit' name='upload_form' value='Upload Now!'> </form>"; } } //print copyright ;-) echo"<p align='right'><br>Script by: <a href='http://www.maaking.com'>maaking.com</a></p>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63865-upload-script-help-needed/#findComment-318642 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.