Avatar of MOSSPOINT
MOSSPOINT
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Uploading multiple files using web application and vb.net

Hi Experts,

I am developing a vb.net web application and have a form with a fileupload contol and it does what is says, uploads a file from the clients browser to my server.

So how can I extend this control to select multiple files in one go, without using javascripr or other 3rd party downloads (becasue I don't know how to use these technologies.

Please include code to show me how this is done.  Thanks.
Visual Basic ClassicWeb Development.NET Programming

Avatar of undefined
Last Comment
MOSSPOINT

8/22/2022 - Mon
Éric Moreau

Umar Topia

Its not possible to upload more than one file using UploadControl at the same time.

You can do something like adding the uploaded file to the session variable and then once user clicks on Upload button, you can upload the files stored in session at the same time
sybe

Why not use multiple UploadControls?
Your help has saved me hundreds of hours of internet surfing.
fblack61
Umar Topia

@sybe:- If it is user's choice to upload as many files he wants, then adding specific number of multiple upload controls won't work
sybe

> adding specific number of multiple upload controls won't work

I am aware of that. But you could decide on a maximal number of files and then have that number of UploadControls. It seems a bit crazy to have the user upload 145 files in one go. Uploading so many files through http has it's own problems.

Of course there are all kinds of more or less fancy solutions to overcome the fact the browser-based file-upload is based on picking files individually, but the asker does not want to use third party controls nor javascript. That limits the solution quite a lot.

I do not see how uploading a file to a session variable is different from uploading a file to a physical directory on the server (at least not from the users point of view).

Umar Topia

If user wants to cancel some file then by some selection, we can remove that file from session variable and while uploading, upload only those files which are there in the session instead of removing the uploaded files from the server machine.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
sybe

Having binary code in the session might cause a memory problem. What if a user uploads a 100MB file? Would you keep the binary code in a session variable?

Oh, and just to notice: if you mean to store just the filepath in session, that is not going to work. Fileupload controls don't accept predefined values. That includes values from a session variable.
Umar Topia

@sybe:- I agree that, Due to security permission, only storing the file path will not work
MOSSPOINT

ASKER
I'm just amazed there's an upload control but not a control that returns a list of files the user has selected  and then allows my code to feed the filenames in to file upload function?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Umar Topia

Due to client machine's security concerns, only one file per upload control is allowed
Éric Moreau

Have you checked my link? It has something that lets you do that.
sybe

> I'm just amazed there's an upload control but not a control that returns a list of files the user has selected  and then allows my code to feed the filenames in to file upload function?

It is not as simple as that. Fileupload has a huge security risk. It must be absolutely prevented that files are uploaded without the user explicitly picking the file. Furthermore the basis of a form in HTML is a corresponce between one <input> and one <value>. Because forms are submitted as key/value pairs.

If there would be one <input> for multiple files, it means a redefinition of how HTML forms are processed, and that isn't something that will happen in the near future (or anytime).
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
MOSSPOINT

ASKER
emoreau

I didn't really want to use flash etc.. but if this is the only solution, how do I use/incorporate it in my solution?

Thanks
ASKER CERTIFIED SOLUTION
Éric Moreau

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MOSSPOINT

ASKER
Thanks