dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: upload file to localhost

  1. #1
    Join Date
    Jan 2006
    Posts
    46

    upload file to localhost

    Is there any restriction to upload file (like .html, .pdf) to localhost? Let say the maximum file size that we can upload? I'm trying to upload some big files, if the file size is more than 5MB, it didnt display the error msg, it wil just display "The page cannot be displayed". why is it like that?

    Function CheckFile() As Boolean
    If file2.PostedFile.ContentLength > 0 Then
    'ContentLength is in bytes (1MB = 1000000 bytes)
    Dim bytes, length As Double
    bytes = file2.PostedFile.ContentLength
    length = bytes / (1024 * 1024)

    If length < 5.0 Then
    lbl_Error2.Visible = False
    Return True
    Else
    Dim Size As String
    Size = CStr(length)
    Size = Size.Substring(0, Size.IndexOf(".") + 3)
    lbl_Error2.Visible = True
    lbl_Error2.Text = "File is too large ! You can upload up to 5MB. current file size is " & Size & "MB"
    Return False
    End If
    Else
    lbl_Error2.Text = "Invalid file"
    Return False
    End If
    End Function

  2. #2
    Join Date
    Oct 2005
    Location
    NYC
    Posts
    108
    it displayed The page cannot be displayed b/c it timed out.

    By default, asp.net allows 4mb upload only. if you want to override that, you must put this into your web.config file.

    <httpRuntime
    executionTimeout="90"
    maxRequestLength="4096"
    />

    the executionTimeout is the amount of time asp.net will wiat before it time out.
    max request length is the allowed size... you have to put that segment at the beginning of your web.config, right after <system.web>.

    remember, these settings are global. if you ahve 2 forms, running on the same web.config, then i suggest you set the maxrequestlength to something big, and control the upload size limit in your application.

    -tak

  3. #3
    Join Date
    Jan 2006
    Posts
    46
    ohh. ic.. then the executionTimeout is measured in seconds? maxRequestLength is in bytes?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles