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
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"
lbl_Error2.Text = "Invalid file"
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.
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.
ohh. ic.. then the executionTimeout is measured in seconds? maxRequestLength is in bytes?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)