Click here to Skip to main content
12,547,922 members (46,517 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


61 bookmarked

File Upload using a VBScript Class

, 29 May 2002
Rate this:
Please Sign up or sign in to vote.
Using a VBScript class to upload files. Useful when you are not able to deploy a custom COM object.
<!-- Download Links --> <!-- Add the rest of your HTML here -->


There are several components on the market that allow your ASP application to handle file uploads. But when you are in a situation where in you are not allowed to install any components then this vbsUpload will be helpful to you. During my Academic Project I was not allowd to use the components on the server and hence found an alternative to Upload the Files from the client end.

Code Support

This is the file which contains the whole logic of the File Upload. The Request.Binary read method is used to read the raw data sent by the client as part of a POST request. ASP provides a method to apply URL encoding rules, but no publicly exposed way to decode. The URLDecode method does that URLDecoding. Then the raw data is parsed and the File elements and Form Elements are separately kept in two collection objects.

This is a simple asp file used to Upload the multipart/form-data. Once the data is available this file will save the file on the hard disk. The file is as follows:
<%@ Language="VBScript" %>
This is another simple file to get multipart/form-data but this will save the data in the Database

This is for using SQLServer to store the files. I have provided the Script to create the Table. So you can create the same table format and use it. Don't forget to fill in the correct Connection String.

This file is used to retreive the binay data from the Database and to display on the Web.
Note: The binary data is written into a file using "Scripting.FileSystemObject" CreateTextFile method. This is not working properly in the case of Excel and other binary files. So limit your usuage only with plain text file. When the file is uploaded to database, the content type is noted and the binary content is saved as Image data type in the SQL Server. Using download.asp the binary data is written back to the client with the proper content type. So there is no problem with the Database File Upload&download. You can upload all the file types (Excel,jpg etc..) using Process_DB.asp.


Now it is easy for me to handle file uploads using ASP and VBScript. I was using this on Windows 2000 Server and Internet Explorer 5. There may be bugs on other versions of the server or client. Please treat this code as a demo version only. It is not meant for production use unless other wise you make it that way.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Hong Kong Hong Kong
No Biography provided

You may also be interested in...


Comments and Discussions

Questionhow get reports of all files from database Pin
Nageshbijoor22-Aug-08 22:59
memberNageshbijoor22-Aug-08 22:59 
Questionimmediately needed Pin
LalithaSundaresan1-Apr-08 23:57
memberLalithaSundaresan1-Apr-08 23:57 
Questionscript to get the name of uploaded Pin
leeechoobkeong27-Aug-07 18:16
memberleeechoobkeong27-Aug-07 18:16 
AnswerRe: script to get the name of uploaded Pin
Nageshbijoor22-Aug-08 22:54
memberNageshbijoor22-Aug-08 22:54 
Generalthanks Pin
landan21-Aug-07 17:55
memberlandan21-Aug-07 17:55 
Generalurgent Please Pin
MErV -The DEV14-Aug-07 1:04
memberMErV -The DEV14-Aug-07 1:04 
QuestionHow to upload big File size Pin
long_great22-Jul-07 22:47
memberlong_great22-Jul-07 22:47 
GeneralGetting error Pin
Nikhil_maverick23-Mar-07 10:27
memberNikhil_maverick23-Mar-07 10:27 
GeneralRe: Getting error Pin
evilmonkey001324-Apr-07 13:46
memberevilmonkey001324-Apr-07 13:46 
GeneralRe: Getting error Pin
long_great22-Jul-07 22:14
memberlong_great22-Jul-07 22:14 
QuestionUploading multiple files Pin
azzawa2-Dec-06 20:13
memberazzawa2-Dec-06 20:13 
QuestionReceiving a file from a client which posts the file as multipart/formdata Pin
kuem09213-Nov-06 19:54
memberkuem09213-Nov-06 19:54 
QuestionRename File during / After Upload Pin
Ryan Powell3-Sep-06 1:56
memberRyan Powell3-Sep-06 1:56 
AnswerRe: Rename File during / After Upload Pin
shillongite18-Sep-06 20:42
membershillongite18-Sep-06 20:42 
AnswerRename File during / After Upload Solution Pin
| kal9091@yahoo.com18-Oct-06 6:07
member| kal9091@yahoo.com18-Oct-06 6:07 
Question'Default' specification can only be used on Property Get Pin
Elitedude20012-Sep-06 9:57
memberElitedude20012-Sep-06 9:57 
QuestionSavse to the disk with MSAccess Pin
RAMOREIRA17-Jan-06 4:09
memberRAMOREIRA17-Jan-06 4:09 
QuestionAnother functionality? Pin
nelsonribeiro30-Oct-05 22:26
membernelsonribeiro30-Oct-05 22:26 
GeneralPossible correction of download.asp file Pin
ribeironl10-Oct-05 3:16
memberribeironl10-Oct-05 3:16 
NewsAdded GetText() function Pin
binarybasher9-Oct-05 23:30
sussbinarybasher9-Oct-05 23:30 
GeneralRe: Added GetText() function Pin
ribeironl10-Oct-05 3:12
memberribeironl10-Oct-05 3:12 
AnswerRe: Added GetText() function Pin
binarybasher10-Oct-05 19:10
sussbinarybasher10-Oct-05 19:10 
AnswerRe: Added GetText() function Pin
binarybasher10-Oct-05 19:15
sussbinarybasher10-Oct-05 19:15 
QuestionCan&#180;t get some things to work... need help! Pin
nelson ribeiro8-Oct-05 5:06
membernelson ribeiro8-Oct-05 5:06 
General[Bug] On errror resume Next Pin
Alec_Eiffel_Jr6-Jun-05 23:17
sussAlec_Eiffel_Jr6-Jun-05 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161021.1 | Last Updated 30 May 2002
Article Copyright 2002 by THIRUMALAIKUMAR
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid