Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Microsoft: ASP (Active Server Pages) FAQ

ASP 102

File Upload by Bullschmidt
Posted: 23 May 03 (Edited 1 Jun 03)

First let's deal with the timeout issue which can be a problem if a user is uploading a fairly large file (although perhaps you don't want the timeout increased too much because you DON'T want a user uploading a large file).

For pure ASP (i.e. non component) solutions (and I believe this would be true for component solutions too) can increase the timeout for the page:
' Script timeout in seconds for this page.
' (60 x 60 = 1 hour.)
Server.ScriptTimeout = 60 * 60

Also the Anonymous Internet user needs Change permission on the folder that a file is going to be uploaded to and actually Full Access might be better if you are later going to use the FileSystemObject to delete a file.

Here are some resources for letting the user upload a file which is something that was unfortunately not built into ASP:

ASP File Upload Using VBScript by John R. Lewis - 7/10/2000
Does NOT use a component.
The clsUpload class uses these other classes: clsCollection, clsFile
Seems to allow for the possibility that a post came in whose form did not have enctype="multipart/form-data" although this doesn't seem to be an issue to me.
There is an internal URLDecode() function in case form submitted with no ENCTYPE="multipart/form-data" in the form tag.
Doesn't have a FileSize property although this can be added.
Assumes the filename will stay the same although it is not hard to slightly modify the class to change this.

UltraFastAspUpload by Cakkie (http://home.planetinternet.be/~aerts1) - 1/3/2002
This page will handle file uploads much faster than other ASP pages.  Indeed, this is a 100% ASP solution, so no need to register any additional components.  The major speed-gain is caused by the conversion from binary to ANSI.  Other codes use a loop and the Chr(AscB(MidB(...))), which is awfully slow.  Doing that with a 1 MB file would result in doing a For T = 1 To 1000000.  When handling a file, the old code took 25 seconds to process the file.  My code needed 2 seconds, need to say more?
Does NOT use a component.
Not a class.
No ContentType.
Assumes the filename will stay the same although it is perhaps not hard to slightly modify the code to change this.
Can't access non-file fields from form.
Cakkie's Web site is not in English.

And here are some other resources:

Applications: File Management: Up/Downloading
Lists resources.

Components: File Management: Up/Downloading
Lists components.

Planet Source Code search on file upload
http://www.planet-source-code.com and search on upload in the ASP/VBScript category

How do I upload files from the client to the server?
Lists resources.

Best regards,
J. Paul Schmidt
www.Bullschmidt.com - Freelance ASP Web Developer
www.Bullschmidt.com/DevTip.asp - ASP Web Developer Tips

Back to Microsoft: ASP (Active Server Pages) FAQ Index
Back to Microsoft: ASP (Active Server Pages) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close