locked
bulk upload in asp.net RRS feed

  • Question

  • User1665719730 posted

    hii

     how to create bulkupload in asp..net

    Friday, September 28, 2018 5:07 AM

All replies

  • User411346422 posted

    You haven't given much detail, but you might investigate the SQLBulkCopy class:

    https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlbulkcopy?view=netframework-4.7.2

    You can use this to upload a data from say a delimited text file into a SQL Server database.

    Friday, September 28, 2018 1:08 PM
  • User283571144 posted

    Hi nagaraji,

     how to create bulkupload in asp..net

    According to your description, I couldn't understand your requirement clearly.

    Do you mean you want to upload mutiple files to the server?

    If this is your requirement, I suggest you could try to use the .FileUpload control with AllowMultiple to ture.

    Like below

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

    More details, you could refer to below codes:

                <asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" />
                <asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick ="UploadMultipleFiles" accept ="image/gif, image/jpeg" />
                <hr />
                <asp:Label ID="lblSuccess" runat="server" ForeColor ="Green" />

    Code-behind:

    protected void UploadMultipleFiles(object sender, EventArgs e)
    {
         foreach (HttpPostedFile postedFile in FileUpload1.PostedFiles)
         {
              string fileName = Path.GetFileName(postedFile.FileName);
              postedFile.SaveAs(Server.MapPath("~/Uploads/") + fileName);
         }
         lblSuccess.Text = string.Format("{0} files have been uploaded successfully.", FileUpload1.PostedFiles.Count);
    }

    Result:

    Best Regards,

    Brando

    Monday, October 1, 2018 7:29 AM
  • User409696431 posted

    As you can tell from the various answers, your requirement is not clear.  Bulk upload of what?

    Wednesday, October 3, 2018 11:47 PM