Last post Apr 13, 2013 07:51 AM by drDubbelklick
Sep 21, 2011 05:42 AM|alwaysonline|LINK
how can we upload multiple files at a time...
my requirement is, when i click on browse buttton, i shud be able to select multiple images at a time, not clicking browse button every time for every image nd uploading all at once
then i shud be able to use upload button, i want event handler in upload button
lot of application in net are using flash buttons for uploading button, or clicking on browse button every time for selecting every image, or when we select multiple images, directly they are getting uploaded with the use of upload button...
thanks in advance
Sep 21, 2011 05:57 AM|mayank arora|LINK
USE Yahoo Yui Toolkit (multiple file uploader)
or use Silverlight multiple file uploader.
Sep 23, 2011 02:31 AM|Decker Dong - MSFT|LINK
protected void btnUpload_Click(object sender,
Sep 23, 2011 07:25 AM|alwaysonline|LINK
not the above one, we shud be able to select multiple images in a single browse click nd then upload
Sep 23, 2011 07:51 AM|Decker Dong - MSFT|LINK
In fact I think you can try this:
1) Drag and drop a GridView and set two fields: One is checkboxfield, while the other is a common BoundField.
<asp:Template HeaderText="Choose Files">
<asp:CheckBox Id="chkBox" runat="server"/>
<asp:Template HeaderText="File Path">
<asp:Label Id="lbFilePath" runat="server" Text='<%#Eval("FilePath")%>'/>
<asp:Button Id="btnSubmit" runat="server" Text="Upload All" />
Your codes behind:
var result = from path in Directory.GetFiles("Your File Path From your PC","*.*",SearchOption.AllDirectories);
FilePath = path
GridView.DataSource = result;
And in the end, double click the button and say——
FileUpLoad fp = new FileUpLoad();
foreach(GridViewRow row in GridView.Rows)
CheckBox chkbox = (CheckBox)row.FindControl("chkBox");
Label lb = (Label)row.FindControl("lbFilePath");
Nov 11, 2011 04:09 AM|magicmike2011|LINK
Nice! Awesome solution! I hate when people always just simply suggest some third-party control when you really want a solution you can develop yourself. Great suggestion and I think may check this out too.
Another solution I was thinking of trying was the following:
adding a set number of fileupload controls, lets say 5 for an example.
then on click of the upload button, get the 5 controls from the control container and insert them into a List<FileUpload> and create a method that accepts this list as a parameter. In the method do a foreach loop that performs all the validation on each
control's filestream and, if valid, performs the upload. Could even get fancy if you wanted and run each upload on it's own background thread asynchronously.
I like the method you described though as it allows you to bind the gridview to the files on the pc. One question though, to allow the gridview to be bound to the filepath from the client machine, does it require any permissions? I mean will it ask the user
to allow the page to access local files or will it just do it automatically? I never really tried it before
Apr 13, 2013 07:51 AM|drDubbelklick|LINK
When I try your solution in IE9, on either single or multiple file, IE9 just replaces the contents with the first file being dropped, and all else vanishes. I must be doing some minor error. Besides, your code does not work straight off the box. I had to
resort to some modifications, but I do not think they are to blame, since they come
after the files have been dropped.
There must be something trivial I am doing wrong. I even tried it in Firefox, with the same result, i.e. the first file dropped fills the browser screen. What are the others doing that I am not?
I can post my code, but await the 2 second answer first :-)