Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I want to upload multiple image file just like 10,100,200 or 400 image file upload one time in asp.net project folder(folder name "Images").
Posted
Comments
Afzaal Ahmad Zeeshan 8-Nov-15 7:07am    
Why?

If you upload an image, like of 1MB size, then even just 10 images would cause the request to have 10MB of data. Users with slow internet connection would lose the process and upload would be cancelled.

Now, the answer is, you can upload as many images as you want. Just increase the maximum HTTP request size and upload the images you want.

use uploadify

use jquery.uploadify.js, jquery-1.3.2.min.js,uploadify.css

XML
<asp:FileUpload ID="file_upload" runat="server" />
                         (Upload Multiple File Required Flash Player)

<a href="javascript:$('#<%=file_upload.ClientID%>').fileUploadStart()" class="bttnPage">Start Upload</a>
use this in below of your code
<script type = "text/javascript">
    $(window).load(
    function () {
        $("#<%=file_upload.ClientID %>").fileUpload({
            'uploader': 'scripts/uploader.swf',
            'cancelImg': 'images/cancel.png',
            'buttonText': 'Browse Files',
            'script': 'upload_demo.ashx',
            'folder': '~/demo_pdf/',
            'fileDesc': 'Pdf Files',
            'fileExt': '*.pdf',
            'multi': true,
            'auto': false
        });
    }
);
</script>


Create Handler upload_demo.ashx

public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        context.Response.Expires = -1;
        try
        {
            HttpPostedFile postedFile = context.Request.Files["Filedata"];

            string savepath = "";
            string tempPath = "";
            tempPath = "~/demo_pdf/";
            savepath = context.Server.MapPath(tempPath);
            string filename = postedFile.FileName;
            if (!Directory.Exists(savepath))
                Directory.CreateDirectory(savepath);

            postedFile.SaveAs(savepath + @"\" + filename);
            context.Response.Write(tempPath + "/" + filename);
            context.Response.StatusCode = 200;
        }
        catch (Exception ex)
        {
            context.Response.Write("Error: " + ex.Message);
        }
    }
 
Share this answer
 
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave over half a million hits: Google "multiple image file upload in asp.net c#"[^]
On teh first page was an article from this very site: Upload multiple files in asp.net[^]

In future, please try to do at least basic research yourself, and not waste your time or ours.
 
Share this answer
 
Agreed with the comment.

You need to create the chunks of these files and upload it using Worker (JavaScript solution).
Search for for the concepts.

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900