Connecting Tech Pros Worldwide Help | Site Map

Pure ASP Upload - script unable to redirect for larger files

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 18th, 2008, 10:15 PM
ll
Guest
 
Posts: n/a
Default Pure ASP Upload - script unable to redirect for larger files

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_INF O") & "?" &
Request.ServerVariables("Query_String"))
case else response.write "<br><Font Color=red>Some form error.</
Font><br>"
end Select
End If

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.