473,378 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Pure ASP Upload - script unable to redirect for larger files

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tihon | last post by:
Hello! I again need your help, just can't understand whats going on. Got this upload pictures form and it's having problem handling large files (~1.5 - 2 MB). Everything works fine if i just...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
1
by: PeterB | last post by:
Hi! I'm using Pure ASP File Upload (http://www.asp101.com/articles/jacob/scriptupload.asp) to upload a file from a client to a server. I am testing both on a local IIS and a remote server. The...
16
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've...
2
by: sabrina.tremblay | last post by:
Bonjour à tous, voici mon problème : J'utilise asp.net 2.0, je me suis fixée un <httpRuntime executionTimeout="3000" maxRequestLength="11264"/dans mon web.config pour pouvoir uploader des fichier...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.