Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Uploading Multiple Files....

Uploading Multiple Files....

Scheduled Pinned Locked Moved ASP.NET
cssdesignsysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pavya_Cool
    wrote on last edited by
    #1

    Hi to All, Here i am trying to upload multiple files on a server. This works fine for the files having size less than 4 to 5 MB, but whenever i trying to upload the file whos size is more than that it even does not take that file. Here i am using a List box to contain the files to be uploaded. the code for "add files" and "upload files" as follows.... //code for Add file Button private void AddFile_Click(object sender, System.EventArgs e) { lblStatus.Visible=true; lblStatus.Text=""; //call to HideControl() HideControls(1); bool b=true; if (Page.IsPostBack == true) { listFileList.AutoPostBack=true; // This function adds the selected files in the List Box. // if the file is not selected then it dispalyes the error message. // Check for the availability of the files in the FindFile control. if (FindFile.Value!="") { if (listFileList.Items.Count!=0) { for (int i=0; i1) Upload.Text= "Upload All"; else Upload.Text= "Upload File"; listFileList.AutoPostBack=true; }// end of AddFile_Click() // Code for Upload file button private void Upload_Click(object sender, System.EventArgs e) { if (!IsPostBack==false) { HideControls(1); //string stat1=""; string baseLocation = Server.MapPath("~/Files/Upload/"); string status = ""; if((listFileList.Items.Count == 0) && (filesUploaded == 0)) { lblStatus.Text = "Error - a file name must be specified."; return; }// end of if // call to CheckUploadFile() to check availability of the details of specified file CheckUploadFile(); // if details of all files available then only it uploads these files if (stat == "") { HtmlInputFile HIF = new HtmlInputFile(); foreach(System.Web.UI.HtmlControls.HtmlInputFile HIF1 in hif) { string fn = ln + "-" + System.IO.Path.GetFileName(HIF1.PostedFile.FileName); if (File.Exists(baseLocation+fn)==false) { HIF1.PostedFile.SaveAs(baseLoc

    M 1 Reply Last reply
    0
    • P pavya_Cool

      Hi to All, Here i am trying to upload multiple files on a server. This works fine for the files having size less than 4 to 5 MB, but whenever i trying to upload the file whos size is more than that it even does not take that file. Here i am using a List box to contain the files to be uploaded. the code for "add files" and "upload files" as follows.... //code for Add file Button private void AddFile_Click(object sender, System.EventArgs e) { lblStatus.Visible=true; lblStatus.Text=""; //call to HideControl() HideControls(1); bool b=true; if (Page.IsPostBack == true) { listFileList.AutoPostBack=true; // This function adds the selected files in the List Box. // if the file is not selected then it dispalyes the error message. // Check for the availability of the files in the FindFile control. if (FindFile.Value!="") { if (listFileList.Items.Count!=0) { for (int i=0; i1) Upload.Text= "Upload All"; else Upload.Text= "Upload File"; listFileList.AutoPostBack=true; }// end of AddFile_Click() // Code for Upload file button private void Upload_Click(object sender, System.EventArgs e) { if (!IsPostBack==false) { HideControls(1); //string stat1=""; string baseLocation = Server.MapPath("~/Files/Upload/"); string status = ""; if((listFileList.Items.Count == 0) && (filesUploaded == 0)) { lblStatus.Text = "Error - a file name must be specified."; return; }// end of if // call to CheckUploadFile() to check availability of the details of specified file CheckUploadFile(); // if details of all files available then only it uploads these files if (stat == "") { HtmlInputFile HIF = new HtmlInputFile(); foreach(System.Web.UI.HtmlControls.HtmlInputFile HIF1 in hif) { string fn = ln + "-" + System.IO.Path.GetFileName(HIF1.PostedFile.FileName); if (File.Exists(baseLocation+fn)==false) { HIF1.PostedFile.SaveAs(baseLoc

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      PRB: Cannot Upload Large Files When You Use the HtmlInputFile Server Control

      :

      RESOLUTION To resolve this problem, use one of the following methods: • In the Machine.config file, change the maxRequestLength attribute of the configuration section to a larger value. This change affects the whole computer. • In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 8 megabytes (MB) to be uploaded:

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups