narjis Posted June 6, 2011 Share Posted June 6, 2011 Hi, I want to add another file on the same form if a user wants to upload more than one files to his directory. Can anybody suggest how to do it. Thanx. <?php [color=red]if($_POST['Submit'])header("Location: zipCreate.php") elseif($_POST['addFile']){ echo "";[/color] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="<?php $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data" name="form2" id="form2"> <div align="center" style="background-color:#006666; font-weight:bold; color:#33FF99;">CREATING ZIP FILE</div> <p>Choose a File to add to zip <input type="file" name="file" /> <input name="addFile" type="submit" id="addFile" style="background-color:#006666; border: 1px; color: #33FF99; font-family: 'Times New Roman', Times, serif; font-weight: bold; font-size: 16px;" value="Add File" align="absmiddle" /> </p> <p> <input align="absmiddle" style="background-color:#006666; border: 1px; color: #33FF99; font-family: 'Times New Roman', Times, serif; font-weight: bold; font-size: 16px;"type="submit" name="Submit" value="Upload File" /> </p> </form> </body> </html> I am having two submit buttons one is for adding more files and another one is for Uploading the files. Then I want to make a zip file of all the uploaded files and save it on the server. Quote Link to comment https://forums.phpfreaks.com/topic/238525-adding-another-field-in-the-same-form/ Share on other sites More sharing options...
mikesta707 Posted June 6, 2011 Share Posted June 6, 2011 There are many scripts and tutorials on the internet for handling multiple file uploads on the front end/client side. This is usually handled via javascript or some other sort of client side language unless you simply want to add a static amount of upload boxes. A quick google search will aid you in this part of it. As far as the PHP, read here: http://php.net/manual/en/features.file-upload.multiple.php that details how you handle multiple file uploads on the php side. Quote Link to comment https://forums.phpfreaks.com/topic/238525-adding-another-field-in-the-same-form/#findComment-1225751 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.