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. fail to upload a larger file...

fail to upload a larger file...

Scheduled Pinned Locked Moved ASP.NET
debuggingcsharpcsssysadminhelp
4 Posts 3 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.
  • V Offline
    V Offline
    vicky457
    wrote on last edited by
    #1

    I have a page to upload file as attachment for user's input. If file size is less than 4MB, it works fine. But once the file size is bigger than 4MB, the page will either hang or display "The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings..." The .aspx file is as the following:

    The code behind is as shown below: Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick If Not MyFile.PostedFile Is Nothing And MyFile.PostedFile.ContentLength > 0 Then ' Get the fully qualified path at client Dim strFileName As String = MyFile.PostedFile.FileName ' Recover only the attached file name Dim c As String = System.IO.Path.GetFileName(strFileName) Dim SaveLocation As String SaveLocation = System.Web.HttpContext.Current.Request.PhysicalApplicationPath() & UploadFolder + c Try MyFile.PostedFile.SaveAs(SaveLocation) Span1.InnerHtml = "Your File Uploaded Sucessfully at server as : " & SaveLocation Catch Excp As SystemException Span1.InnerHtml = "An Error occured:" & Excp.Message End Try End If End Sub I tried to trace the code in Submit1_ServerClick(), but this function does't execute at all. I am use .NET 1.1 and debug on my local machine. I have no clue why the larger file doesn't work... Does anyone have any ideas about it? Any advice would be very appreciated! Thanks in advance!

    D V 2 Replies Last reply
    0
    • V vicky457

      I have a page to upload file as attachment for user's input. If file size is less than 4MB, it works fine. But once the file size is bigger than 4MB, the page will either hang or display "The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings..." The .aspx file is as the following:

      The code behind is as shown below: Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick If Not MyFile.PostedFile Is Nothing And MyFile.PostedFile.ContentLength > 0 Then ' Get the fully qualified path at client Dim strFileName As String = MyFile.PostedFile.FileName ' Recover only the attached file name Dim c As String = System.IO.Path.GetFileName(strFileName) Dim SaveLocation As String SaveLocation = System.Web.HttpContext.Current.Request.PhysicalApplicationPath() & UploadFolder + c Try MyFile.PostedFile.SaveAs(SaveLocation) Span1.InnerHtml = "Your File Uploaded Sucessfully at server as : " & SaveLocation Catch Excp As SystemException Span1.InnerHtml = "An Error occured:" & Excp.Message End Try End If End Sub I tried to trace the code in Submit1_ServerClick(), but this function does't execute at all. I am use .NET 1.1 and debug on my local machine. I have no clue why the larger file doesn't work... Does anyone have any ideas about it? Any advice would be very appreciated! Thanks in advance!

      D Offline
      D Offline
      Daniel Santillanes
      wrote on last edited by
      #2

      submit1_serverclick is in the process of being executed, but first the file has to be uploaded, the problem is the file size limit (default is 4MB) To increase the max length, add the following to your web.config in the system.web element: <httpRuntime maxRequestLength = "8192" /> daniero

      V 1 Reply Last reply
      0
      • D Daniel Santillanes

        submit1_serverclick is in the process of being executed, but first the file has to be uploaded, the problem is the file size limit (default is 4MB) To increase the max length, add the following to your web.config in the system.web element: <httpRuntime maxRequestLength = "8192" /> daniero

        V Offline
        V Offline
        vicky457
        wrote on last edited by
        #3

        Hi, Thank you very much for helping me out! I tried to use obviously, it didn't work... Again,thank you very much!!

        1 Reply Last reply
        0
        • V vicky457

          I have a page to upload file as attachment for user's input. If file size is less than 4MB, it works fine. But once the file size is bigger than 4MB, the page will either hang or display "The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings..." The .aspx file is as the following:

          The code behind is as shown below: Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick If Not MyFile.PostedFile Is Nothing And MyFile.PostedFile.ContentLength > 0 Then ' Get the fully qualified path at client Dim strFileName As String = MyFile.PostedFile.FileName ' Recover only the attached file name Dim c As String = System.IO.Path.GetFileName(strFileName) Dim SaveLocation As String SaveLocation = System.Web.HttpContext.Current.Request.PhysicalApplicationPath() & UploadFolder + c Try MyFile.PostedFile.SaveAs(SaveLocation) Span1.InnerHtml = "Your File Uploaded Sucessfully at server as : " & SaveLocation Catch Excp As SystemException Span1.InnerHtml = "An Error occured:" & Excp.Message End Try End If End Sub I tried to trace the code in Submit1_ServerClick(), but this function does't execute at all. I am use .NET 1.1 and debug on my local machine. I have no clue why the larger file doesn't work... Does anyone have any ideas about it? Any advice would be very appreciated! Thanks in advance!

          V Offline
          V Offline
          vik20
          wrote on last edited by
          #4

          Here is a post explaining the problems of uploading large file in asp.net 2.0 http://vikramlakhotia.com/Post.aspx?postID=7 Vikram

          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