Important alert: (current site time 7/15/2013 11:29:23 PM EDT)
 

winzip icon

ASPFileUpload_NonWSC

Email
Submitted on: 9/12/2000 4:14:45 PM
By: Kevin Pirkl 
Level: Intermediate
User Rating: By 9 Users
Compatibility: ASP (Active Server Pages)
Views: 30769
author picture
(About the author)
 
     Let your users upload files through their web browser to an IIS web server. Previously I uploaded a WSC version of this code but many requests came in for a non Window Script Component Version. This version is extracted from the WSC into a simple .inc file that you can place on your own web site. Thanks to Vadim Maslov for the original work that I cleaned up and added the SaveAs function and ASP implementation sample to.
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
' for :ASPFileUpload_NonWSC
'**************************************
'Per the usual.. Make backups of everything and 
'follow the directions closely when installing 
'the latest Microsoft scripting engines. This 
'sample works but is only intended for your 
'edification how you use it is up to you.
'Also I wanted to say thanks to Vadim Maslov 
'for the original VB Script implementation that 
'this was adapted from.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

9/22/2000 6:48:22 PMpirklk@providence.org

Did some testing and here are the results. The getByteString and getString are real slow. Try uploading a small file say 10k or less. Larger files are much slower with this script and timeouts can occur. Here are some additions I made to help my scripts Response.Expires=0 and Response.ExpiresAbsolute=#May 31,1996 13:30:15# and also Server.ScriptTimeout = 100 that is in seconds. This helped. Clear your browser cache before you begin testing again. Also add a [Clear/Refresh] button to the top. You might make the page submit to a save page as opposed to itself. Buffering is seeming to be a possible problem here as well. Kevin.
(If this comment was disrespectful, please report it.)

 
2/27/2001 12:13:56 PMKevin Pirkl

Hi all... You can email me direct with questions.. I will attempt to help as best as I can. pirklk@providence.org Common errors include not having adequate permissions on the directory you are trying to write to. There are two places to look at permissions. 1> In IIS itself. You need to check off the write checkbox on the directory that you will be writing to. 2> You will need to be sure to set the NT ACLs to with Read/Write permissions on the directory that you will be writing to. I recommend creating an \upload directory and setting the permissions on that directory.
KP
(If this comment was disrespectful, please report it.)

 
6/14/2001 11:19:19 AMKevin Pirkl

Updated the ZIP file to remove previous bugs.
(If this comment was disrespectful, please report it.)

 
10/12/2001 5:09:54 AMThomas Sturm

weeell, I just downloaded the code and as far as I can see it is really well written (
(If this comment was disrespectful, please report it.)

 
10/12/2001 11:44:13 AMKevin Pirkl

What an uplifting sentiment! If you would like to re-do it and take credit for the work go right ahead. You sound like my College CS profs who nicked me points for lack of comments within my code. I always thought about telling them to piss off but never did cause they were only trying to make me more rigid in my standards. I realized that they were only trying to help.

Know this though if you going to knock people on this site for lack of comments you might as well ask 90 percent of us to pull our code as well and you would be wasting your breath. If you want to learn then this is the site of the masters.

Also, I dont recommend going with a script based file upload anyway. The String cat built into it is very very slow and there are many freeware upload COM objects available out there.

Best of luck on your work.

Happy coding.
(If this comment was disrespectful, please report it.)

 
5/27/2002 5:01:57 PMMathieu

Your script is taking so much of CPU ressources and is very slow with bigger files, but it is just perfect for small file. Do you have some tips to improve its performances.
(If this comment was disrespectful, please report it.)

 
5/30/2002 6:48:40 PMJay

Anyone can upload code, so this isn't
"the site of masters." And code that works isn't necessarily good code.
(If this comment was disrespectful, please report it.)

 
5/31/2002 7:48:42 PMKevin Pirkl

There is nothing wrong with the code. It is an example and that is all. If you want to convert it to a DLL then do so. Otherwise bugger off.
(If this comment was disrespectful, please report it.)

 
6/4/2002 12:08:21 PMJason

Code working swell for me. I am trying to incorporate it into one of my pages now. I have an asp page with a form on it with 3 text boxes(Comments,Steps,Documents). I want to be able to click submit and upload the file to the server, create an html link to the file in the Documents textbox but keep that same page open so they can finish filling in all the boxes before submiting the whole record. Any way I can do this? Or must I have the Upload File on its own page?

Basically I want it to reload the page with all the data they've typed in so they can upload 2-3 files on the same page and have 3 links in the textbox and click finish once all of its done.

Any tips at all would be greatly appreciated. Thx for the code!
(If this comment was disrespectful, please report it.)

 
4/9/2003 5:07:36 PM

I found the code very usefull, especially for small files (anything over 130k always timed out). After a lot of searching this was the first usefull code I found. Comments for the fucntion were a welcomed suprise.I am going to test the WSC version as well.
Nice piece of code.

(If this comment was disrespectful, please report it.)

 
4/27/2004 3:50:48 PM

It's working great, but I really don't want to have all the file info. What should I do to remove the file info that is written out after I upload?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.