Shims Posted July 3, 2003 Posted July 3, 2003 (edited) 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: 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 Edited July 3, 2003 by Robby Quote Stress is directly associated with programming. But if I keep moving on to new stresses, then I am doing my job correctly!
Moderators Robby Posted July 3, 2003 Moderators Posted July 3, 2003 (edited) I would change the IFs and add PostedFile to the Saveas btw, do you really want to allow files of 100 Mb ? If Request.Files.Count > 0 and file.ContentLength < 102400000 and file.ContentType = "text/plain" Then file.PostedFile.SaveAs(strfilename) end if Edited July 3, 2003 by Robby Quote Visit...Bassic Software
WebJumper Posted July 8, 2003 Posted July 8, 2003 I can answer your question: Search for "machine.conig" on your HD (my file is under "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CONFIG\" there is a line like this: <httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/> Change the "maxRequestLength" to a number you need. Standart this are 4MB (4096Byte) The Timeout is in minutes... Regards, Stefan Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.