Prev: File not found error using #include virtual with UNC path
Next: XML document must have a top level element
From: ll on 18 Aug 2008 18:11 I'm working with 'pure ASP upload' script which is designed to redirect to an alert/error message, should a file larger than the set limit be attempted to be uploaded. The problem is that, while smaller files do upload successfully, the script does not catch the larger files and rather than a specific error message in Firefox (and IE7), I just get the following: ------------------------------------ The connection was reset The connection to the server was reset while the page was loading. * The site could be temporarily unavailable or too busy. Try again in a few moments. * If you are unable to load any pages, check your computer's network connection. * If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web. --------------------------------- here's the script (below) for the database upload. Thanks for any help or resources. Kind Regards, Louis --------------------------------- '////////////////////////////////////////////////////////////////////////////////////////////// 'Simple upload to database. 'Suitable for small files - up to 20% of physical server memory 'This sample works with any connection - MDB (JetOLEDB, ODBC) ' MS SQL (MSDASQL/ODBC) etc. 'Server.ScriptTimeout = 240 'Simple upload to database Response.Write(Request.QueryString("CourseID")) Dim Form: Set Form = New ASPForm %> <!--#include virtual="/common/upload/_upload.asp"--> <% Server.ScriptTimeout = 1000 Form.SizeLimit = 1024*1024*10'10MB MaxFileSize = Form.SizeLimit 'was the Form successfully received? Const fsCompletted = 0 If Form.State = fsCompletted Then 'Completted dim objConnection, RS 'Open connection to database Set objConnection = GetConnection Set RS = Server.CreateObject("ADODB.Recordset") 'Open dynamic recordset, table Upload RS.Open "AMS_ContentOverviewLecture", objConnection, 2, 2 RS.AddNew 'One-block assigning/AppendChunk is suitable for small files '(<20% physical server memory). Plese see documentation to store '10th megabytes or more in database. 'Add file from source field 'SourceFile' to table field 'Data' 'Store extra form info. RS("CourseID") = Form("strCourseID") RS("WeekNum") = Form("strWeekNum") RS("MainTopicNum") = Form("strMainTopicNum") 'Add file from source field 'SourceFile' to table field 'Data' RS("image_blob") = Form("SourceFile").ByteArray 'Store technical informations RS("ContentType") = Form("SourceFile").ContentType RS("filename") = Form("SourceFile").FileName strFileName=RS("filename") RS("filesize") = Form("SourceFile").Length strFolderPath = strFolderPath&strFileName RS("FolderPath") = strFolderPath RS.Update RS.Close objConnection.Close ElseIf Form.State > 10 then Const fsSizeLimit = &HD Select case Form.State case fsSizeLimit: response.status = "413 Request Entity Too Large" response.write "<script type=""text/javascript"">alert (""Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B) (10MB) \n The file was NOT uploaded"")</script>" Response.End() 'Server.Transfer(Request.ServerVariables("PATH_INFO") & "?" & Request.ServerVariables("Query_String")) case else response.write "<br><Font Color=red>Some form error.</ Font><br>" end Select End If
From: Anthony Jones on 19 Aug 2008 04:04 "ll" <barn104_1999(a)yahoo.com> wrote in message news:b2f1bdd0-ff6b-454b-a5a3-a13a14e5b510(a)d45g2000hsc.googlegroups.com... > I'm working with 'pure ASP upload' script which is designed to > redirect to an alert/error message, should > a file larger than the set limit be attempted to be uploaded. The > problem is that, while smaller files do upload > successfully, the script does not catch the larger files and rather > than a specific error message in Firefox (and IE7), I just get the > following: > ------------------------------------ > The connection was reset > The connection to the server was reset while the page was loading. > * The site could be temporarily unavailable or too busy. Try > again in a few > moments. > * If you are unable to load any pages, check your computer's > network > connection. > * If your computer or network is protected by a firewall or > proxy, make sure > that Firefox is permitted to access the Web. > --------------------------------- > here's the script (below) for the database upload. Thanks for any > help or resources. > Kind Regards, > Louis > > --------------------------------- > '/////////////////////////////////////////////////////////////////////////// /////////////////// > 'Simple upload to database. > 'Suitable for small files - up to 20% of physical server memory > 'This sample works with any connection - MDB (JetOLEDB, ODBC) > ' MS SQL (MSDASQL/ODBC) etc. > > 'Server.ScriptTimeout = 240 > 'Simple upload to database > > Response.Write(Request.QueryString("CourseID")) > Dim Form: Set Form = New ASPForm %> > <!--#include virtual="/common/upload/_upload.asp"--> > <% > > Server.ScriptTimeout = 1000 > Form.SizeLimit = 1024*1024*10'10MB > MaxFileSize = Form.SizeLimit > > 'was the Form successfully received? > Const fsCompletted = 0 > > If Form.State = fsCompletted Then 'Completted > > dim objConnection, RS > 'Open connection to database > Set objConnection = GetConnection > Set RS = Server.CreateObject("ADODB.Recordset") > > > 'Open dynamic recordset, table Upload > RS.Open "AMS_ContentOverviewLecture", objConnection, 2, 2 > RS.AddNew > > > 'One-block assigning/AppendChunk is suitable for small files > '(<20% physical server memory). Plese see documentation to store > '10th megabytes or more in database. > > 'Add file from source field 'SourceFile' to table field 'Data' > 'Store extra form info. > RS("CourseID") = Form("strCourseID") > RS("WeekNum") = Form("strWeekNum") > RS("MainTopicNum") = Form("strMainTopicNum") > 'Add file from source field 'SourceFile' to table field 'Data' > RS("image_blob") = Form("SourceFile").ByteArray > 'Store technical informations > RS("ContentType") = Form("SourceFile").ContentType > RS("filename") = Form("SourceFile").FileName > strFileName=RS("filename") > > RS("filesize") = Form("SourceFile").Length > > strFolderPath = strFolderPath&strFileName > RS("FolderPath") = strFolderPath > > > RS.Update > RS.Close > > objConnection.Close > > > ElseIf Form.State > 10 then > Const fsSizeLimit = &HD > Select case Form.State > case fsSizeLimit: response.status = "413 Request Entity Too Large" > response.write "<script type=""text/javascript"">alert (""Source > form size (" & Form.TotalBytes & "B) exceeds form limit (" & > Form.SizeLimit & "B) (10MB) \n The file was NOT uploaded"")</script>" > Response.End() > 'Server.Transfer(Request.ServerVariables("PATH_INFO") & "?" & > Request.ServerVariables("Query_String")) > case else response.write "<br><Font Color=red>Some form error.</ > Font><br>" > end Select > End If By default IIS6 has maximum entity body limit set to 200K. Any POST which carries a Content-Length greater than 200K will be rejected immediately by IIS it'll drop the connection in order to prevent inbound bandwidth being consumed by the upload. -- Anthony Jones - MVP ASP/ASP.NET
From: Toni on 19 Aug 2008 12:09 "Anthony Jones" wrote... > :> By default IIS6 has maximum entity body limit set to 200K. Any POST which > carries a Content-Length greater than 200K will be rejected immediately by > IIS it'll drop the connection in order to prevent inbound bandwidth being > consumed by the upload. > > > -- > Anthony Jones - MVP ASP/ASP.NET Anthony, can you tell me if there is a setting to increase that 200K upload limit? And does this 200K limit only apply to ASP scripts, or is it applicable to CGI scripts running on IIS6 as well? Thanks! Toni
From: Anthony Jones on 19 Aug 2008 16:09
"Toni" <Toni24(a)yahoo.com> wrote in message news:uwCunYhAJHA.1628(a)TK2MSFTNGP02.phx.gbl... > "Anthony Jones" wrote... > > > :> By default IIS6 has maximum entity body limit set to 200K. Any POST which > > carries a Content-Length greater than 200K will be rejected immediately by > > IIS it'll drop the connection in order to prevent inbound bandwidth being > > consumed by the upload. > > > > > > -- > > Anthony Jones - MVP ASP/ASP.NET > > Anthony, can you tell me if there is a setting to increase that 200K upload limit? > > And does this 200K limit only apply to ASP scripts, or is it applicable to CGI scripts > running on IIS6 as well? The metabase property AspMaxRequestEntityAllowed defaults to 200K so for POST to ASP you need to increase this limit. The overall IIS limit is controlled by MaxRequestEntityAllowed which defaults to 4GB therefore should not be a problem. -- Anthony Jones - MVP ASP/ASP.NET |