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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically display a new file input if one has been filled 1

Status
Not open for further replies.

chrismassey

Programmer
Aug 24, 2007
264
GB
Hello,

I have created a system to upload files onto my server. Currently I have 5 file inputs. However, sometimes this is either too many or most importantly too little. Often there could be limitless number of files to upload, therefore being able to upload only 5 files at a time is unsuitable.

I have tried searching in Google for a solution however I haven't come across one. 1and1 provide a webspace explorer system with a suitable solution to this problem. They display a single file input, and if it has been filled (obviously by a file the user wishes to download), then a 2nd file input is dynamically displayed below. Then again if the 2nd file input is filled then a 3rd is displayed etc etc.

I have absolutely no idea how I could do this using javascript so does anyone have any ideas, or any links which may help me?

Please note that I am uploading files using a PHP script therefore each file input has to be separately identified by giving each one a unique number (i.e. input 1 value=file1, input 2 value=file2, input 3 value=file3 etc). Therefore I would also need to be able to pass the final value (the number of files to be uploaded) into a php script variable, or even simply printing the total into a standard textbox would do fine.

Thank you very much in advance,

Chris
 
Thank you Billy,

I investigated those methods and I found the perfect solution. I managed to find a script which lists all the files selected, which can be kept or removed before pressing upload and actually uploading them, and it works almost perfectly.

Thank you ever so much

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top