Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to allow upload of multiple files

Status
Not open for further replies.

hondavtr

Programmer
Aug 23, 2002
4
AU
I have the code to upload one file, or multiple files at once. I need to display a page where the user chooses a file to upload and the name is shown, then chooses another etc .... then at the end when the form is submitted all files are uploaded.

The problem is I don't know how to dynamically add the upload rows, as it needs to be limitless. There is another form on the page too.

The only thing I can think of is to add the file chosen to an array and actually resubmit the form to the same page after every file is chosen showing the names of all the files already in the array.

There has to be a better/easier way (if what I'm thinking of would even work).
Anyone have any idea?
 
You could make your "upload files" page have a drop-down where the user can choose how many files he/she wants to upload. You could set the default to 5 or something like that. You could use JavaScript to make the drop-down submit itself upon change, or use a submit for that form and send it to the page. //Daniel
 
Good idea, but what's the javascript to dynamically make the inputs?
 
This should work:
Code:
<select name=&quot;files&quot; onchange=&quot;window.location.href='uploadfiles.php?files=' + this.options[selectedIndex];&quot;>
<option value=&quot;5&quot;>5 files</option>
etc.
This might not work, since I haven't used JavaScript for ages. You could try and ask in the JavaScript forum or wait for someone to answer it here. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top