Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have added the following javascripts in my aspx page...

<script src="jquery-1.3.2.js" type="text/javascript"></script>
<script src="jquery.MultiFile.js" type="text/javascript"></script>

I have also added the following code in the button click operation.

 HttpFileCollection hfc = Request.Files;
    for (int i = 0; i < hfc.Count; i++)
    {
        HttpPostedFile hpf = hfc[i];
        if (hpf.ContentLength > 0)
        {
            hpf.SaveAs(Server.MapPath("MyFiles") + "\\" + System.IO.Path.GetFileName(hpf.FileName));
            Response.Write("<b>File: </b>" + hpf.FileName + " <b>Size:</b> " + hpf.ContentLength + " <b>Type:</b> " + hpf.ContentType + " Uploaded Successfully <br/>");
        }
    }

The problem is I can't select mulltiple files...!!!

 <asp:FileUpload id="FileUploadControl" class="multi" runat="server"/>
        <asp:Button ID="BtnUpload" runat="server" onclick="BtnUpload_Click" 
            Text="Upload" Width="105px" style="margin-top: 4px" />
        <asp:Label runat="server" id="StatusLabel" text="Upload status: " />

http://www.c-sharpcorner.com/UploadFile/prathore/multiple-file-upload-using-jquery-in-Asp-Net-3-5/

share|improve this question

2 Answers 2

up vote 0 down vote accepted

just make it multiple

<asp:FileUpload id="FileUploadControl" Multiple="Multiple" class="multi" runat="server"/>
share|improve this answer
    
Not working with IE8. Do I need to change the browser? –  user34567890 Mar 1 at 4:43
    
try without jquery just as regular call –  COLD TOLD Mar 1 at 4:44
    
Its working fine in Chrome. But I want to get the full path of the uploaded file, which is not possible in chrome.. Do you have any suggestions ? –  user34567890 Mar 1 at 4:47
    
you need to add a call back –  COLD TOLD Mar 1 at 5:15
    
I have rectified the issue with chrome, but I can't get the full path of the uploaded file in Chrome.. how to solve it ? –  user34567890 Mar 1 at 5:17

you should use AjaxFileUpload instead of file upload. This is an ajax control toolkit component. After that you create the event that will get each file. It alredy uploads and give to you the link that the file was uploaded.

    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

  <ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1"
    ThrobberID="myThrobber"
    ContextKeys="Vinicius"
    AllowedFileTypes="jpg,jpeg"
    MaximumNumberOfFiles=10
    runat="server"/>
share|improve this answer
    
Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified. Unknown server tag 'ajaxToolkit:AjaxFileUpload'. Do I need to install something else ?? –  user34567890 Mar 1 at 4:44
    
Yes you need to install the free ajax control tookit: ajaxcontroltoolkit.codeplex.com –  VINICIUS SIN Mar 1 at 15:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.