Ads 468x60px

For New Update Use this Link Offer for you


Friday, 26 July 2013

How to upload multiple photos using

How to upload multiple photos using
Introduction :- 

In my previous  article i have explain the Ajax-asyncfileupload-control-example in Now in this article we will upload multiple image using single file upload control in

Description :- 

In this Article we take on file upload control and on button on web from.This is very important article for upload multiple image in database and folder .now we upload the multiple images in a folder some  easy process

Step 1 - Create a web project and add new from like this
Open visual stdio go to File->new ->Project  and write the name of the project

Step 2 - Write click on solution explorer and add new item ->select new web form->write the name of form

step 3 -  Drag and drop the file upload control on the form
Step 4 - Drag and drop the Button on the form
Step 5 - Drag and drop one label on the form for count how many image you have select
Step 6 - Write click on Project (Solution Explorer) and add new folder and give the name to the folder is image

Note -: Write multiple="true" for select multiple file or  image using file upload control of
Note - use this namespace    using System.IO;

Complete Source Code as shown below

<asp:FileUpload runat="server" ID="UploadImages" multiple="true"/>
    <asp:Button runat="server" ID="uploadedFile" Text="Upload" OnClick="uploadFile_Click" />
    <asp:Label ID="listofuploadedfiles" runat="server" />

double Click on button control or write click on from and select  View Code .Go to code Behind File and write a code for upload a images in folder.

Code as shown below

      HttpFileCollection fileCollection = Request.Files;
        for (int i = 0; i < fileCollection.Count; i++)
        HttpPostedFile uploadfile = fileCollection[i];
        string fileName = Path.GetFileName(uploadfile.FileName);
        if (uploadfile.ContentLength > 0)
        uploadfile.SaveAs(Server.MapPath("~/image/slider/") + fileName);
        listofuploadedfiles.Text += String.Format("{0}<br />",uploadfile.FileName);

1 comment:



New Updates

Related Posts Plugin for WordPress, Blogger...

Related Result