Pure ASP Upload - script unable to redirect for larger files

L

ll

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
 
A

Anthony Jones

ll said:
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.
 
T

Toni

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, 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
 
A

Anthony Jones

Toni said:
...
:> By default IIS6 has maximum entity body limit set to 200K. Any POST which

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top