I am using an asp.net page that allows an upload of plain text files to the server. Everything works great, except every time i want to upload a file over 5 megs, i get a "cannot display webpage" error. this is the code I am using:
Code:
Dim file As HttpPostedFile
Dim dateinfo As String
Dim root As String
Dim strfilename As String
dateinfo = "(" & DateTime.Now.Date.Month & "-" & DateTime.Now.Date.Day & "-" & DateTime.Now.Date.Year & ")" & " [hr" & DateTime.Now.Hour & " min" & DateTime.Now.Minute & " s" & DateTime.Now.Second & "]"
Try
MkDir("C:\Inetpub\wwwroot\WriteMe\" & Session("ClearanceCode"))
Catch
End Try
root = "C:\Inetpub\wwwroot\WriteMe\" & Session("ClearanceCode") & "\"
strfilename = "C:\Inetpub\wwwroot\WriteMe\" & Session("ClearanceCode") & "\" & dateinfo & ".txt"
check that a file has been uploaded
If Request.Files.Count <= 0 Then
Else
get the file data
file = Request.Files.Get(0)
check thats its not too big
If file.ContentLength > 102400000 Then
Else
If file.ContentType <> "text/plain" Then
Else
save file
file.SaveAs(strfilename)
End If
End If
End If
Last edited by a moderator: