how to store the multiple image in database and pass it to the webpage help me to find it out.

Last Reply 8 days ago By kalpesh

Posted 12 days ago

getting difficulty to store the image in the give path and because the image is not store in the database it not shown in the web page

 <asp:FileUpload ID="fuMultipleImage" runat="server"  AllowMultiple="true"  />
    public void InsertMultipleImage()

        foreach (HttpPostedFile postedFile in fuMultipleImage.PostedFiles)

            string filename = Path.GetFileName(postedFile.FileName);
            string targetPath = Server.MapPath("~/Co-Working/Images/" + filename);
            Stream strm = fuMultipleImage.PostedFile.InputStream;
            var targetFile = targetPath;

            fuMultipleImage.SaveAs(Server.MapPath("~/Co-Working/Images/" + targetPath));

        string constr = ConfigurationManager.ConnectionStrings["IECNEWConnectionString"].ConnectionString;
        using (SqlConnection con = new SqlConnection(constr))

            string query = "insert into tblFiles values (@Name, @ContentType, @Data, @CoworkingId)";
            using (SqlCommand cmd = new SqlCommand(query))
                cmd.Connection = con;
                cmd.Parameters.AddWithValue("@Name", filename);
                cmd.Parameters.AddWithValue("@ContentType", "~/Co-Working/Images/" + filename);
                cmd.Parameters.AddWithValue("@Data", 0);
                cmd.Parameters.AddWithValue("@CoworkingId", ViewState["ID"]);





1 property-detail-02.jpg Images\p\property-detail-02.jpg 0x00000000

12 property-detail-03 (1).jpg Images\p\property-detail-03 (1).jpg 0x00000000

13 property-detail-02.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\p\property-detail-02.jpg 0x00000000

34 property-detail-03 (1).jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\p\property-detail-03 (1).jpg 0x00000000

35 property-detail-02.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\property-detail-02.jpg 0x00000000

46 property-detail-03.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\property-detail-03.jpg 0x00000000

47 Deepa kar.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\p\Deepa kar.jpg 0x00000000

58 HUsain-Bolt.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\p\HUsain-Bolt.jpg 0x00000000

59 sakshi.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\p\sakshi.jpg 0x00000000

510 Sitves sindhu.jpg F:\Projects\India Entrepreneur Club\Backup\30-09-2017\IEC\Co-Working\Images\p\Sitves sindhu.jpg 0x00000000

511 IMG_20170910_105600-min.jpg Images/p/IMG_20170910_105600-min.jpg 0x00000000

712 IMG_20170909_223610-min.jpg Images/p/IMG_20170909_223610-min.jpg 0x00000000

813 1.jpg Images/p/1.jpg 0x00000000

914 1.jpg Images/p/1.jpg 0x00000000

915 a.jpg Images/p/a.jpg 0x00000000

1116 a.jpg Images/p/a.jpg 0x00000000

You are viewing reply posted by: Nagesh 11 days ago.
Posted 11 days ago

I have already used this article its working. i am inserting image in folder problem is same image inserting in folder. i want to save diffrent images. 

i am using this control,

 Please give me sample code for inserting multiple image in folder.


please help me out 


<asp:FileUpload ID="fuMultipleImage" runat="server"  AllowMultiple="true"  />


I agree, here is the link: