|
|
 |
| |
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article 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 article (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 article 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 article or article's description.
| |
The secret to the speed lies within ADO's Recordset and Stream objects. The holdback on the previous version was the conversions from ANSI to Unicode, and sometimes back again to ANSI.
Supports multiple file uploads along with multiple field types. Let that user type in a description of the file when they upload it ... etc.
Also supports the ability to retrieve multiple field values with the same name. Although some extra programming would need to be done on your part.
Completely commented walking you through every step along with explinations.
| |
Download article
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 article, you agree to the following terms...
1) You may use
this article 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 article (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 article 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 article or article's description.
|
|
|
Other 102 submission(s) by this author
|
|
| |
Report Bad Submission |
|
| |
| Your Vote! |
|
See Voting Log |
| |
| Other User Comments |
3/21/2002 4:11:25 AM: Cakkie
Now here's a fine peace of code, nice and easy to use. ***** (If this comment was disrespectful, please report it.)
|
3/22/2002 2:30:15 AM: Meni
I like it (If this comment was disrespectful, please report it.)
|
4/9/2002 12:03:14 PM: ald35
Hey thanks a lot for your code, I am new to this and it really helps. I do have a question though. Is there anyway to upload more than one file at a time? Like an entire folder? Or to have the option of selecting multiple files at once? If you have any suggesstions I would really appreciate it. Thanks again man. ald35 (If this comment was disrespectful, please report it.)
|
4/9/2002 2:13:28 PM: Sam Moses
Hey Lewis, I'm working on emulating your technique for database uploads, but when I run the new script, I get an error on line 111. Any ideas? (If this comment was disrespectful, please report it.)
|
4/9/2002 4:37:24 PM: Fabricio
Thanks Lewis, I'll test it in my web host. (If this comment was disrespectful, please report it.)
|
4/10/2002 11:08:55 AM: Fabricio
Lewis, it works fine at local IIS, but with my web hosting server, I have a folow msg: > ADODB.Stream error '800a0bbc' > Write to file failed. > clsField.asp, line 178
I know that your script is correct, but can you help to find what type of restrictions my web hosting server do ??? What should I request to my web hosting server ??? Special directory, write access to public, quota, etc... Ps.: If you have a free time, email me... Thanks , Fabricio (If this comment was disrespectful, please report it.)
|
5/1/2002 12:05:04 PM: Kevin Pirkl
I see some str = str & chr(whatever) kind of code and as we all know string concats are very slow in vb. How well does this handle file uploads of 1mb or more compared to other postings on this site. BTW the Excellent Function and Class BroilerPlates, inline commeting and formatting. I wish all programers took this much care in their work.
K (If this comment was disrespectful, please report it.)
|
5/24/2002 5:43:31 AM: jelzooi
No problems to inslalll
THANKS A LOT (If this comment was disrespectful, please report it.)
|
8/9/2002 2:34:14 AM: Vivek
Nice piece of code..... (If this comment was disrespectful, please report it.)
|
9/3/2002 3:09:39 AM:
Easy to install and reconfigure to my structure.
One thing... how can you setup multipul uploads in the one form?? (If this comment was disrespectful, please report it.)
|
9/3/2002 3:10:39 AM:
Great bit of code mate!!!
One thing... is there anyway to set it up to upload 2 files at once???
Lee (If this comment was disrespectful, please report it.)
|
9/3/2002 4:51:58 PM:
Works great with one file. How can you set it up to upload two files under the same submit button? If anyone knows how to do this, please let me know. (If this comment was disrespectful, please report it.)
|
9/5/2002 10:44:17 AM: Lewis Moten
To upload multiple files, use different names for the INPUT element (name=File1, name=File2). (If this comment was disrespectful, please report it.)
|
9/12/2002 11:26:33 AM:
Hello: It is very good code instead using 3rd party components.
Can I add some others form elements like input fields person name & address ...so on with upload features together in one page. I try, but not successfull.
Thanks (If this comment was disrespectful, please report it.)
|
9/12/2002 10:12:15 PM:
Lewis... i tried changing the form to 2 inputs with different names as you suggested and it still didn't upload... is there something in the asp that needs to be changed??? Lee (If this comment was disrespectful, please report it.)
|
9/12/2002 10:51:21 PM:
Does anyone know how I can get this error fixed?
--error --- ADODB.Stream error '800a0bbc'
Write to file failed.
/dev/clsField.asp, line 178
--ends here--
I've installed a photo album Snitz mod on my forum but it doesn't seem to work due to this error.
thanks kindly for any assistance.
Armand (If this comment was disrespectful, please report it.)
|
9/13/2002 12:29:49 PM:
For uploading 2 fields, I think in ToDatabase.asp files, chnage the code in following will be work. But other good suggestion will welocme.
objRs.AddNew objRs.Fields("FileName").Value = objUpload.Fields("File1").FileName objRs.Fields("FileSize").Value = objUpload.Fields("File1").Length objRs.Fields("ContentType").Value = objUpload.Fields("File1").ContentType objRs.Fields("BinaryData").AppendChunk objUpload("File1").BLOB & ChrB(0)
objRs.AddNew objRs.Fields("FileName").Value = objUpload.Fields("File2").FileName objRs.Fields("FileSize").Value = objUpload.Fields("File2").Length objRs.Fields("ContentType").Value = objUpload.Fields("File2").ContentType objRs.Fields("BinaryData").AppendChunk objUpload("File2").BLOB & ChrB(0)
(If this comment was disrespectful, please report it.)
|
9/15/2002 8:54:31 PM:
Thanks mate... that code is great, excpet that I am only using the code to upload to a file system... can someone help out for us!!!!
Cheers,
Lee (If this comment was disrespectful, please report it.)
|
9/23/2002 6:45:31 PM:
Hi, I've noticed that when you upload very large files (>100 megs on my machine) my server doesn't have enough available memory to deal with this. I'm considering trying to modify the code to process by some chunk size... I dunno, maybe 1024 KB. Since your most familiar with the code, what do you think about modifying it to do something like that? I notice that in the class initialization we read the entire request all of the bytes (mbinData = Request.BinaryRead(mlngBytesReceived)), couldn't we leave that bit out until you actually call SaveAs and in SaveAs read the bytes off the request in chunks? Anyway, I'll check back in a few days...
...
while(RequestData) ParseDelimiter ParseData Wend?????
Sean Hill shill@transcribing.com
(If this comment was disrespectful, please report it.)
|
10/13/2002 2:09:43 PM:
Version 1 would overwrite files, but version 2 gives the error message that two others have mentioned,
ADODB Stream error '800a0bbc' Write to file failed clsField.asp, line 178
This error appears to be an inability for the include file's objects to overwrite an existing file. We're running on NT 4.0 SP6a and IIS 4.0. Does this have anything to do with the version of IIS? We have the latest version of DAO.
Database works great and version 2 handles larger files nicely. Just need to overwrite as version one did.
Thanks! (If this comment was disrespectful, please report it.)
|
10/13/2002 2:10:35 PM:
Version 1 would overwrite files, but version 2 gives the same error message that two others have mentioned,
ADODB Stream error '800a0bbc' Write to file failed clsField.asp, line 178
This error appears to be an inability for the include file's objects to overwrite an existing file. We're running on NT 4.0 SP6a and IIS 4.0. Does this have anything to do with the version of IIS? We have the latest version of DAO.
Database works great and version 2 handles larger files nicely. Just need to overwrite as version one did.
Thanks! (If this comment was disrespectful, please report it.)
|
10/16/2002 5:31:12 PM:
Great code. I have one question, when I attempt to download a file that I have uploaded, the name field in the save dialog is the name of the datafile.asp. I can retype the name here, but is there a way to automate this? Or is it browser dependant? (If this comment was disrespectful, please report it.)
|
10/22/2002 5:23:35 AM:
Just what I am looking for.
Thank you for your great work!!! (If this comment was disrespectful, please report it.)
|
10/24/2002 7:32:13 PM:
Thanks mate... that code is great, excpet that I am only using the code to upload to a file system, and i need to be able to upload 2 files at a time... can someone help out for us!!!! Cheers, Lee (If this comment was disrespectful, please report it.)
|
10/28/2002 4:15:44 PM:
This is a great piece of code and thanks for sharing it. As a side note, I also got the (If this comment was disrespectful, please report it.)
|
10/30/2002 6:59:18 AM:
anyone that already has changed 'tofilesystem.asp' for multiple files upload? (If this comment was disrespectful, please report it.)
|
11/1/2002 4:29:25 AM:
Great code. I think you are missing a Exit Property in clsUpload.asp on line 447. (If this comment was disrespectful, please report it.)
|
11/1/2002 2:50:25 PM:
Excellent work! However, my MAC users are having problems uploading. Any ideas? (If this comment was disrespectful, please report it.)
|
11/28/2002 5:41:57 AM:
This is what I add to my ToFileSystem.asp : ' Grab the file name strFileName = objUpload.Fields( (If this comment was disrespectful, please report it.)
|
11/28/2002 5:44:40 AM:
This is what i add to ToFileSystem.asp :
<snip>
' Grab the file name
strFileName = objUpload.Fields("File1").FileName
strFileName2 = objUpload.Fields("File2").FileName
' Compile path to save file to
strPath = Server.MapPath("Uploads") & "\" & strFileName
strPath2 = Server.MapPath("Uploads") & "\" & strFileName2
' Save the binary data to the file system
objUpload("File1").SaveAs strPath
objUpload("File2").SaveAs strPath2
<snip>
Successfully uploaded 2 files at once at Brinkster (http://www.brinkster.com) and 1ASPHost (http://www.1ASPHost.com). Hope this helps. :P (If this comment was disrespectful, please report it.)
|
12/31/2002 11:49:27 AM:
Dear author, I would like to know how the script support double-byte characters filename? (If this comment was disrespectful, please report it.)
|
1/14/2003 1:15:40 AM:
Very Good Upload program. I like it very much.. You solve alot of the problem that other program didn't do it.. thx.. (If this comment was disrespectful, please report it.)
|
1/16/2003 2:35:47 AM:
i am also getting the (If this comment was disrespectful, please report it.)
|
1/16/2003 2:37:25 AM:
I am also getting the clField.asp line 178 error. Can anyone tell me what the reason is and how i can fix it?
thanks (If this comment was disrespectful, please report it.)
|
1/24/2003 2:09:56 PM:
Hey all... I jsut wanted to say that the clfield.asp error on line 178 is caused by not having the correct folder listed as the upload folder. It probably means that you didn't create the folder 'Uploads', or you changed the name of the folder on line 14 of ToFileSystem.asp, and didn't create a new folder with that name. Hope this helps (If this comment was disrespectful, please report it.)
|
1/30/2003 10:30:31 AM:
Hi. Code works great... but I'm getting the error below when I try to do a (If this comment was disrespectful, please report it.)
|
1/31/2003 8:48:50 AM:
ADODB.Stream error '800a0bbc'
Write to file failed.
/panpodium/cma/upload/clsField.asp, line 178
I have checked the folder location and everything seems fine. I am using a brinkster server. (If this comment was disrespectful, please report it.)
|
1/31/2003 10:10:00 AM:
interesting problem i have found using this script - in ie6 the script will run fine and upload files, however in mozilla 1.2 it seems to fail every time... have checked this several times - any suggestions Lewis? (If this comment was disrespectful, please report it.)
|
2/10/2003 3:02:09 AM: Mike Vos
Hi There Great code but is there any way to retrieve and use field values from other fields on the input form as well as upload files? Thanks (If this comment was disrespectful, please report it.)
|
2/12/2003 1:58:45 PM:
Beautiful code. I'm new to this and out of curiosity I browsed through what you had written. It blew my mind. Good Stuff. (If this comment was disrespectful, please report it.)
|
2/12/2003 10:51:54 PM:
This is very useful and very helpful to the beginning ASP user especially! Thanks very much. (If this comment was disrespectful, please report it.)
|
2/22/2003 8:33:01 PM:
To add two or more files to the folder, not the database do this: add ^INPUT type="File" name="File2"^ to the demo.asp page (or whatever u're calling it) add strFileName2 = objUpload.Fields("File2").FileName under the first call in ToFilesysttem.asp and strPath2 = Server.MapPath("Uploads") & "\" & strFileName2 and objUpload("File2").SaveAs strPath2
just repeat that 100 times if u want (If this comment was disrespectful, please report it.)
|
2/26/2003 9:09:31 AM:
Hi I'm getting the error ADODB.Stream error '800a0bbc' Write to file failed. it seems others have had the same problem, i've tried various paths and still have the problem, is there a fix? ta (If this comment was disrespectful, please report it.)
|
2/26/2003 11:25:43 AM:
I am getting the same ADODB.Stream error '800a0bbc' Write to file failed, is there a fix? If so, this would be a big help! Thanks! (If this comment was disrespectful, please report it.)
|
2/27/2003 9:38:21 PM:
I too am getting the "ADODB.Stream error '800a0bbc' Write to file failed" error. I verified the directories exist and it is a directory that I do have write permission to. Does anyone have the solution? jperella@comcast.net (If this comment was disrespectful, please report it.)
|
3/3/2003 3:37:04 PM:
Same (If this comment was disrespectful, please report it.)
|
3/3/2003 5:55:23 PM:
2/27/2003 9:38:21 PM: I too am getting the (If this comment was disrespectful, please report it.)
|
3/4/2003 6:32:29 PM:
Found the stream object error problem. It's the browser! Probably an http referrer problem, but it worked in IE but not in Opera. The problem is that the FileName is not being passed with the file by Opera (and maybe by other browsers.) Here's a workaround (next comment), that at least saves the upload with a name that is unique. (If this comment was disrespectful, please report it.)
|
3/5/2003 4:02:41 AM:
dim objUpload, objFile, strFileName, strPath
' set upload dir for this site:
strPath = "D:\Websites\Site5\Uploads\"
' Note: I usually set the above as an application variable, as in:
'strPath = application("ULPath")
' Instantiate Upload Class
Set objUpload = New clsUpload
' call once for each file
sb_SaveFile "1"
' Release objects from memory
set objFile = nothing
set objUpload = nothing
(If this comment was disrespectful, please report it.)
|
3/5/2003 4:04:48 AM:
' part 3:
public sub sb_SaveFile(FileNum)
' get file object
set objFile = objUpload("File" & FileNum)
' get filename
strFileName = objFile.FileName
if len(strFileName) < 1 then ' browser didn't pass information
strFileName = year(date) & month(date) & day(date) & hour(now) & minute(now) & second(now) & ".unknown"
response.write "Creating artificial filename (" & strFileName & ") because your browser did not pass the name with the file.
"
end if
' Save the binary data to the file system
objFile.SaveAs strPath & strFileName
end sub
(If this comment was disrespectful, please report it.)
|
3/11/2003 1:46:10 AM:
I'm also having problems with uploading other data into the database along with the file name. like a basic description.. how do i do this? Please help!! (If this comment was disrespectful, please report it.)
|
3/11/2003 7:07:46 PM:
This code works like a dream when using IE but -- as already noted -- fails in other browsers with the (If this comment was disrespectful, please report it.)
|
3/11/2003 7:08:36 PM:
This code works like a dream when using IE but -- as already noted -- fails in other browsers with the "clsField.asp, line 178" error. I'm afraid I'm not advanced enough to understand the work-around suggested above. Still, even if we're limited to IE we're way ahead of the game. Thanks. (If this comment was disrespectful, please report it.)
|
3/17/2003 6:55:43 PM:
Hey Lewis thanks a lot for your code, it really helped me a lot.I have a question though. Is there anyway to add another textbox.I'm trying to name the file differently. Here is the code I have; objRs.AddNew objRs.Fields( (If this comment was disrespectful, please report it.)
|
3/25/2003 5:58:02 AM:
I have a form with many inputs (tex fields, selection lists, etc) along with the ability to upload a file. However, when I attempt to extract the form information (Request.Form) as well as upload the file I get the following error:
Cannot call BinaryRead after using Request.Form collection. /status/clsUpload.asp, line 85
How do I work around this issue? (If this comment was disrespectful, please report it.)
|
3/27/2003 10:59:29 AM:
Insert these two lines after line 200 in inc_clsField.asp to solve the browser problem: Else ' Added for browsers that don't pass the path FileName = pstrPath ' (i.e. only file name is passed). It's really a nice piece of code. (If this comment was disrespectful, please report it.)
|
3/31/2003 1:32:53 PM: bab2002
thanks much works perfect (If this comment was disrespectful, please report it.)
|
4/1/2003 10:07:11 PM:
Nice code...I tried it and it works. Now I try to add some other input on the form like user's name and file description. How can I do this. I'm new to ASP and it's hard for me to figure it out. Can anyone know this tell me how? Thanks. (If this comment was disrespectful, please report it.)
|
4/2/2003 3:42:08 PM:
First thanks for your great code - this uploading code is so good that I can't find words to describe it. Second - I have found a way to show on a rejected form what the user chose before, but I don't like it. It’s too long. So, my question is, how do I make my forms show what the user has selected before, and one more thing, a user can select multiple check boxes and make multiple <SELECT> choices. Please help me. (If this comment was disrespectful, please report it.)
|
4/3/2003 8:52:33 PM:
Hi, fantastic code, i tried a bunch and this one actually works! I am trying to process text fields to my database in the same page, is this possible with this code? Anyone know a work around? Thanks (If this comment was disrespectful, please report it.)
|
4/9/2003 7:57:12 AM:
Best opensource ASP upload script i've found! I like it better than Dundas, which is also installed on my server, but this script even has a couple of advantages over Dundas.
Feature request: variable to limit the size of uploads for safety reasons, together with an array to limit the acceptable file extensions for files that are allowed to be uploaded. i've added these things myself to the code, but it would be neat if they were already builtin.
thanks for the great script! (If this comment was disrespectful, please report it.)
|
4/9/2003 5:48:14 PM:
This script looks like it will be great! However, when I tried to run the demo on our web server, I got this error message:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/ctdp/Upload2/clsField.asp, line 111
Public Property Get BLOB() ----------------^ (If this comment was disrespectful, please report it.)
|
4/9/2003 5:49:19 PM:
This code is just what I have been looking for!
However, I'm getting this error message when running DEMO.asp on our web server:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/ctdp/Upload2/clsField.asp, line 111
Public Property Get BLOB() ----------------^
(If this comment was disrespectful, please report it.)
|
4/13/2003 8:34:59 PM:
I've tried to put in all the code that you guys have mentioned previously, however I don't think I did it right because I'm still getting the:
ADODB.Stream error '800a0bbc'
Write to file failed.
/chris/Upload2/clsField.asp, line 178
If anyone would be kind enough to either e-mail me or place a message (for beginners like me) on here describing where to place certain snippits of code to fix this problem it would be greatly appreciated, thanks in advance. (p.s. I'm using IE 6.0) Chris Mallett cmallett@telus.net (If this comment was disrespectful, please report it.)
|
4/18/2003 5:52:40 PM:
It uploads faster than previous versions programmers have submitted, but not as user friendly. User should be able to decide how many files to upload. (If this comment was disrespectful, please report it.)
|
4/19/2003 7:13:16 PM:
Nice and fast. Easily customized. Greatly appreciated! I originally got the [ADODB.Stream error '800a0bbc' Write to file failed.] error but found it to be a simple NTFS permissions problem. Once I gave the IUSR_ account write access to the folder, the error disappeared. (If this comment was disrespectful, please report it.)
|
4/21/2003 12:54:07 PM:
I'm using a For loop to upload as many files as the user inputs, but to determine how many files they want to upload, I have to use request.form and I'm getting an error, "Can not call request.form after binary read". Why is this, and is there a fix without sending the number of files in the URL? (If this comment was disrespectful, please report it.)
|
4/23/2003 11:09:46 AM:
copying all binary to local variable is not scalable. It can't handle very large files! (If this comment was disrespectful, please report it.)
|
5/2/2003 2:35:21 PM:
how do you restrict the file type that is to be uploaded? (i.e. .gif, .jpg, etc) (If this comment was disrespectful, please report it.)
|
5/8/2003 9:57:07 AM:
I am using this code but then the uploaded files are being saved to C:/inetpub/.../.. . How do I get it to save to the server? Please Help
(If this comment was disrespectful, please report it.)
|
5/10/2003 4:14:15 PM:
Friends, Error "Write to file failed" is related to de OS not to web server or asp code. Just give NTFS write permission to the "Uploads" folder... (If this comment was disrespectful, please report it.)
|
5/11/2003 11:01:19 PM:
The upload to database is great. I added a category table in the database and added a category field in the files database. I want to add a category drop list on the upload form so that after a file is selected for uploading, a category from the list will also be selected and the information posted to the database. This will allow me to create queries in the database by category and then display to users depending on their security rights. If you can help me, this will put the final touch to this already great code. Thanks. (If this comment was disrespectful, please report it.)
|
5/12/2003 8:33:44 PM:
Just out of curiosity, what would be the biggest file (size wise) that you would use this method to upload a file with (that sentence seems awkward.......... (If this comment was disrespectful, please report it.)
|
5/23/2003 12:17:02 AM:
I am trying to upload 2 files at the time, which I've seen the code for above. I also need to input information in text boxes and drop down lists at the same time. How do I do this? Menzer@TigerLaxREMOVETHISPART.com (If this comment was disrespectful, please report it.)
|
5/26/2003 1:30:47 AM:
I need to input information in text boxes and drop down lists at the same time. I've seen that others have asked this, too, but I haven't seen an answer....How do I do this? (If this comment was disrespectful, please report it.)
|
5/26/2003 8:05:15 PM:
I'm having problems getting multiple values from a list box also.. i only get one instead of say, 3. Has anyone found a solution to this problem? (If this comment was disrespectful, please report it.)
|
5/29/2003 9:46:15 PM:
How good are you. This is faster than any component anyways. Love your work. Keep it up, and keep posting it. I Hope I can contribute a piece at a similar level. Thanks Mate. (If this comment was disrespectful, please report it.)
|
5/29/2003 9:48:19 PM:
Hey Mate, This code is a great piece of work. Well done!! and Thanks for the posting of it. I hope I can submit a piece that will rival it! Love your work. Thanks again mate. (If this comment was disrespectful, please report it.)
|
5/30/2003 9:09:40 AM:
Nice peace of work but i need a thing to be added in it and i m unable to do that can u help me
I want to add a text box that will take some comment abt the file along with the file name can you do this for me. i have tried but..... i m a bit new to asp thanx in advance (If this comment was disrespectful, please report it.)
|
6/1/2003 10:57:52 PM:
still having probs with this: I'm having problems getting multiple values from a list box also.. i only get one instead of say, 3. Has anyone found a solution to this problem? (If this comment was disrespectful, please report it.)
|
6/4/2003 12:36:46 AM:
I still haven't found anything for this: I need to input information in text boxes and drop down lists at the same time. I've seen that others have asked this, too, but I haven't seen an answer....How do I do this? (If this comment was disrespectful, please report it.)
|
6/5/2003 6:56:01 PM:
Well, great stuff. I love classes (I use classes for everything). Just wish I ha done it first;-) Ok, just wanted to point out that an Exit Property statement is missing on line 447 in clsUpload.asp. The problem does not appear until you try to use enumerated fields rather than referencing them by their key value. Also, for all you "cut and paste" programmers complaining about missing features, if you knew real programming you would realize how many feature this class has and what a great example of encapsulation it is. Thanks a lot it has saved me much time at work. (If this comment was disrespectful, please report it.)
|
6/9/2003 7:51:08 PM:
Hi Lewis...Thank you for this code...it is very good and invaluable and I believe it has saved me months of coding (and heartache)...
One question though:
How do I manage to use the response.write method with your script?
Reason being I'm uploading files but want to submit additional information and then process this info, but it falls over in the clsUpload.asp file on line 85 and gives me the following error message
"Cannot call BinaryRead after using Request.Form collection."
Any Suggestions?? (If this comment was disrespectful, please report it.)
|
6/10/2003 7:52:35 PM:
I really cant find anything anywhere else about using the objUpload.Fields("listofkeywords").Value code to display multiple values from a list box.. you cant use request.form because it wont work! HELP!! (If this comment was disrespectful, please report it.)
|
6/17/2003 12:57:54 PM:
i used the code for sql server but it gives me an error ADODB.Field (0x800A0C93) Operation is not allowed in this context. /upload/upload2/ToDatabase.asp, line 30 i dunno what it means.Ihave the binarydata field in datbase a binary,is it this that is messing up please help (If this comment was disrespectful, please report it.)
|
6/26/2003 12:11:22 AM:
Hi Lewis...Thank you for this code it is very good (If this comment was disrespectful, please report it.)
|
7/6/2003 5:20:14 PM: Alist.com
hello, greate code....I have a few questions 1. How to you rename the upload file and make it unique 2. How do you remove the file inside the folder (If this comment was disrespectful, please report it.)
|
7/7/2003 2:32:40 AM:
Lewis, Great Code! best of seen of open source. Works _almost_ as advertised! only one problem, but was caught by a previus post.
on 6/5/2003 6:56:01 PM: to the author of that post: Awesome insight! saved me hours of heartache! The code IS missing an Exit Properties statement in clsUpload.asp at 447. Works like a charm now! (If this comment was disrespectful, please report it.)
|
7/7/2003 10:07:37 AM:
"Cannot call BinaryRead after using Request.Form collection." problem
I had to scratch my head a few times before I realized how obvious it was to manipulate hidden fields in your form.
Use the syntax objUpload("(NameOfHiddenField)").value
The request.form functionality has been entirely replaced with objUpload. (If this comment was disrespectful, please report it.)
|
8/5/2003 1:10:29 AM:
Lewis, this is incredible code. I mimic everyone's comments. I have the same question that doesn't appear to be answered here. (If this comment was disrespectful, please report it.)
|
8/12/2003 2:29:48 PM:
Great code...thanks for your efforts! I have a question concerning uploading files. I get an error that says Request object error 'ASP 0104 : 80004005' Operation not Allowed /upload/clsUpload.asp, line 85
Any ideas on how to fix? I only seem to get this with larger files over a few hundred kb. Thanks again! (If this comment was disrespectful, please report it.)
|
8/12/2003 2:32:06 PM:
Great code! Thanks for all your efforts! I get this error on uploads over a few hundred kb. Any ideas how to fix? Thanks again!
Request object error 'ASP 0104 : 80004005' Operation not Allowed /upload/clsUpload.asp, line 85 (If this comment was disrespectful, please report it.)
|
9/3/2003 9:57:14 AM:
I am new at asp programming and these pieces of code were just what I was looking for. Is there any way to limit the file size and type? Thank for the great piece of coding! (If this comment was disrespectful, please report it.)
|
9/7/2003 1:13:33 AM:
Just started networking and learning about code is there any specific thing I should study or place of information that would be of assistance? If you know of any I WOULD GREATLY APPRECIATE ANY RESPONDS to shamel@dustdevil.com. THANK YOU (If this comment was disrespectful, please report it.)
|
9/26/2003 12:19:27 PM:
happen to know the max file size upload? mpkempf@hotmail.com
thanks. (If this comment was disrespectful, please report it.)
|
10/8/2003 2:35:34 AM:
can i use this code for uploading to a remote machine?what is the path?what about permissions?
(If this comment was disrespectful, please report it.)
|
10/8/2003 2:37:01 AM:
Can i use this code for uploading to a remote server?how can i get the path?and what about permission? (If this comment was disrespectful, please report it.)
|
10/8/2003 3:18:45 PM:
I have your code uploading and displaying the files, but I am seeing garbage instead of the expected file content. I am using a MS Access database and had to make changes to get the connections to work. I created a table in the database to which I store the documents. I have used a memo type data field for the document information. Can you help me determine what I have done incorrectly? (If this comment was disrespectful, please report it.)
|
10/15/2003 9:28:26 PM:
What would i use instead of request.form? (If this comment was disrespectful, please report it.)
|
10/22/2003 11:35:51 AM:
I recieves this error when trying to use the software? Error Type: Microsoft VBScript runtime (0x800A0005) Invalid procedure call or argument: 'MidB' /upload1/clsUpload.asp, line 102
Any Ideas how to fix? Thanks......... (If this comment was disrespectful, please report it.)
|
10/22/2003 5:21:39 PM:
Regarding the (If this comment was disrespectful, please report it.)
|
10/22/2003 5:23:16 PM:
Regarding the ADODB Stream error '800a0bbc' Write to file failed clsField.asp, line 178 error. Part of the problem is that certain browsers do not pass the entire file's path to the server, passing instead just the file's name. Adding an "Else... FileName = pstrPath" to the "If... End If" conditional statement on line 199 of file "clsField.asp" will solve this problem. (If this comment was disrespectful, please report it.)
|
11/4/2003 6:05:56 PM:
I'm still getting the ADODB Stream error '800a0bbc' Write to file failed clsField.asp, line 178 error. I tried adding an "Else... FileName = pstrPath" to the "If... End If" conditional statement on line 199 of file "clsField.asp" and am still getting the error.. (If this comment was disrespectful, please report it.)
|
11/5/2003 12:42:31 PM:
Nevermind the last post I fixed the problem it was a permissions issue... Awesome code! Thanks (If this comment was disrespectful, please report it.)
|
11/10/2003 9:02:05 AM:
How can I verify the file path that is being entered by the user; verify that the file actually exists at the path that is entered into the file input box? (If this comment was disrespectful, please report it.)
|
11/12/2003 10:45:25 PM:
Perfect code if your using MSACCESS but when i was using it for sql server 2000 it gives me an error ADODB.Field (0x800A0C93) Operation is not allowed in this context. /db/ToDatabase.asp, line 29 which refers to: objRs.Fields("BinaryData").AppendChunk objUpload("File1").BLOB & ChrB(0) im not quite familiar with what it means.I have the binarydata field in database a binary, please help.. thanks (If this comment was disrespectful, please report it.)
|
11/17/2003 1:29:02 PM:
Great code, but there are a couple of gotchas. First, a lot of people reported the problem with (If this comment was disrespectful, please report it.)
|
11/17/2003 1:57:14 PM:
(part 1) Sorry to repeat myself, but this system has bugs -- it printed only the start of my comment. This code is great, but it has some gotchas. First, there is the 'write to file failed' error from line 178. This is fixed by adding write permission to the Upload folder for the IUSR account. Second, you cannot use the index value on the fields (e.g., objUpload.Fields(3)). This is fixed by adding 'Exit Property' on line 447 (just before the ELSE statement). (If this comment was disrespectful, please report it.)
|
11/17/2003 1:57:46 PM:
(part 2) Third, the code will generate an error for the MidB function (from line 102) if you load the code when there is no form data. For example, this will occur if you instantiate the objUpload object on a page that was not reached by a submitted form. Fix this by sandwiching line 102 between IF/Else/End IF statements. The IF statement should be 'if len(mbinData) > 0 then', followed by 'ELSE mstrDelimiter = ""'. Essentially, it says if mbinData has no length (no data), then just set mstrDelimiter to nothing. (If this comment was disrespectful, please report it.)
|
12/11/2003 5:37:23 AM:
"Is there any way to limit the file size and type?" This is what i want to know, same as the previous mate. again, thank for the great piece of coding! (If this comment was disrespectful, please report it.)
|
12/22/2003 11:01:53 PM:
It's a piece of great code. I found an error message as what most of them faced: ---------------------------------- ADODB.Stream error '800a0bbc' Write to file failed. /uploads/clsField.asp, line 178 ---------------------------------- By creating a sub folder called (If this comment was disrespectful, please report it.)
|
12/24/2003 1:14:53 PM:
Lewis, great code. Is there a way that I can change the name of the file. I want to change the name of the file to the user_id in my application. Thanks (If this comment was disrespectful, please report it.)
|
1/2/2004 1:24:57 AM:
Great code...thanks for your efforts! I have a question concerning uploading I want to know if this is fixed or not? ---------------------------------------------------- files. I get an error that says Request object error 'ASP 0104 : 80004005' Operation not Allowed /upload/clsUpload.asp, line 85 Any ideas on how to fix? I only seem to get this with larger files over a few hundred kb. Thanks again! ---------------------------------------------------- thanks
Steve (If this comment was disrespectful, please report it.)
|
1/12/2004 8:34:41 AM:
Lewis, This code works great. However, I am now using it again to upload .wav files to a database. It works great except with huge files. When uploading large files nothing happens or it shows in database that file size is 0 and it does not add a name or anything. Is there something I can do to fix this problem (If this comment was disrespectful, please report it.)
|
1/19/2004 8:25:19 AM:
Hey Lewis, great script! Like others I'm having problems extracting added infomation via (If this comment was disrespectful, please report it.)
|
1/19/2004 11:29:58 AM:
Hey Lewis, great script! Like others I'm having problems extracting added infomation, decription etc via the request.form process, I get -" Cannot call BinaryRead after using Request.Form collection "-. How would this be resolved Regards Pete (If this comment was disrespectful, please report it.)
|
1/23/2004 6:08:38 PM:
I'm getting error cannot display page ToFileSystem.asp
any ideas? (If this comment was disrespectful, please report it.)
|
1/26/2004 1:01:58 AM:
I used ur code and found it quite useful. But there are some flaws in it(I think so). First of all, while downloading from database, it downloads the file as (If this comment was disrespectful, please report it.)
|
1/26/2004 1:07:10 AM:
I used ur code and found it quite useful. But there are some flaws in it(I think so). First of all, while downloading from database, it downloads the file as "DataFile.asp" instead of downloading it as the file name which was uploaded. Secondely, is there any way to reupload the file to the asme field of database? Please reply me ASAP (If this comment was disrespectful, please report it.)
|
1/26/2004 11:50:21 PM: Lewis Moten
Please use version 3 if you are looking at this upload code for the first time. This code is for showing the progress of the upload script. (If this comment was disrespectful, please report it.)
|
2/4/2004 3:28:55 AM:
Were you able to upload the picture on the server while inserting a corresponding record in a database? (If this comment was disrespectful, please report it.)
|
2/4/2004 3:30:01 AM:
Hi guys, Were anyone of you able to upload a file while inserting a corresponding record in a database? I would appreciate your help. Thanks (If this comment was disrespectful, please report it.)
|
2/11/2004 4:15:33 AM:
i've got 2 errors on running the script
1st : to file system Error Type: ADODB.Stream (0x800A0BBC) Write to file failed. /uploadtest/clsField.asp, line 178
2nd : to database Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. /uploadtest/ToDatabase.asp, line 31
please help
(If this comment was disrespectful, please report it.)
|
2/24/2004 4:03:54 PM:
This doesn't work through Mac OSX on IE 5.2.3, Unix file system probably different. (If this comment was disrespectful, please report it.)
|
3/17/2004 1:24:00 AM:
Dude. This code is awesome and works perfectly. Just incredible. Thank you sincerely. (If this comment was disrespectful, please report it.)
|
4/9/2004 10:33:14 AM:
Can't seem to get this code to work using Linux/Unix clients. Anyone have any work arounds for this. Same error as reported by others, ADODB.Stream error '800a0bbc', works from all my Windows clients though... (If this comment was disrespectful, please report it.)
|
4/14/2004 10:40:49 AM:
I am using your code and it works great, however, now I want to save a file onto a different server i.e. server A is my web server and contains your code, server B is my data server where i want to store images.
I have tried a mapped drive and a url and can't seem to get it working, any ideas? you help would be appreciated. (If this comment was disrespectful, please report it.)
|
4/15/2004 1:17:43 PM:
i have using this for several months and it is absolutely flawless. one question, though, I have someone trying to upload files using a Mac, and they consistantly get this error:
ADODB.Stream error '800a0bbc'
Write to file failed.
/eventManager/clsField.asp, line 179
any ideas? (If this comment was disrespectful, please report it.)
|
4/20/2004 3:02:18 AM:
Thank You for the code I am getting the following error on large files: Request object error 'ASP 0104 : 80004005' Operation not Allowed Upload2/clsUpload.asp, line 85 Please tell me what I can do in order to solve the problem Thank you hagit-10@012.net.il (If this comment was disrespectful, please report it.)
|
4/22/2004 2:17:25 PM:
Excellent code! I'm receiving one error though when trying to open certain file types, for example text files. When I click on the link, it want to try and open DataFile.asp. Thanks! (If this comment was disrespectful, please report it.)
|
5/19/2004 9:53:56 AM:
This use to work just fine but we recently upgraded to Windows 2003 server reinstalled all websites and now get this error: Request object error 'ASP 0104 :
80004005' Operation not Allowed
This is generated by the statement: Request.BinaryRead(lngTotalBytes)
Your help is most appreciated!
(If this comment was disrespectful, please report it.)
|
5/20/2004 10:32:39 AM:
Here is the answer to the Windows 2003 error - 'ASP 0104 : 80004005' Operation not Allowed .
It is a new setting in IIS 6.
http://www.dmxzone.com/ShowDetail.asp?NewsId=5424 (If this comment was disrespectful, please report it.)
|
5/21/2004 2:03:47 AM:
Its work fine.But it cant pass the array of form fields .It also not work the objupload(i).name or objupload(i).value.But its count the no of form fields. If possible pls check and fixed it Harsh (If this comment was disrespectful, please report it.)
|
5/26/2004 5:09:34 PM: tsimes
I am receiving the error you addressed on Line 102 of clsUpload.asp: Invalid procedure call or argument: 'MidB' . I added the If statement, but am still receiving the error. Any ideas? (If this comment was disrespectful, please report it.)
|
6/8/2004 12:48:44 PM:
Great code.......you really did a good job......but since some of use aren't as lucky I will ask the expert (YOU) I get the following error message (Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.) Help! Look forward to hearing from you.
(If this comment was disrespectful, please report it.)
|
6/8/2004 9:46:48 PM: Lewis Moten
Well, make sure that your IUSR_machinename account has security to modify your access file. Also, try out version 3 by searching for it on planet source code. (If this comment was disrespectful, please report it.)
|
6/9/2004 9:57:43 AM:
Lewis……………....thanks! You’re the greatest! I changed the IUSR permissions and it worked great! Thanks again………..
Trish
(If this comment was disrespectful, please report it.)
|
6/9/2004 10:58:10 AM: Lewis Moten
I'm glad i could help out. (If this comment was disrespectful, please report it.)
|
6/29/2004 12:15:13 PM:
I've been working with your code for three days now, Lewis. There's a hang up on my end and I can't seem to track it down. I've gone from the (If this comment was disrespectful, please report it.)
|
6/29/2004 4:53:57 PM: Lewis Moten
Try version 3
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=8525&lngWId=4 (If this comment was disrespectful, please report it.)
|
7/6/2004 6:12:21 AM:
I don't know how to edit this example because i don't know VB script, i know JavaScript, any one have JavaScript version of this example?
regards issa rabba (If this comment was disrespectful, please report it.)
|
7/6/2004 6:14:36 AM:
any one has JavaScript version on this example? caz i don't know wrting VBscript (If this comment was disrespectful, please report it.)
|
8/19/2004 8:45:46 AM:
Can I add some others form elements like input fields person name & address. I tried and doesn't work (If this comment was disrespectful, please report it.)
|
9/14/2004 7:43:32 AM:
the scripts works great, but when i tried to upload an empty file, the file didnt get uploaded :(, how to solve this problem? (If this comment was disrespectful, please report it.)
|
10/1/2004 11:43:12 AM:
Possible Remedy - Error '800a0bbc' Write to file failed --I ran into the same problem - Here's something to check -- 1. Make sure that the directory you are uploading to has write permissions 2.Check physical path that Server.MapPath( (If this comment was disrespectful, please report it.)
|
11/1/2004 11:26:00 AM:
I like this code! It works perfectly. Is it possible to get a progress-bar in it? I want to know how far the upload is while uploading larger files... Anyone? (If this comment was disrespectful, please report it.)
|
11/7/2004 6:22:02 AM:
I get no error but noting is uploadedas well
here is my code I hope it willl pass through http://www.ciaimages.com/upload.txt
(If this comment was disrespectful, please report it.)
|
12/2/2004 9:26:01 AM:
I cann't upload file with Chinese character file name. It seems that the function CStrU in clsUpload.asp cann't work well with pstrANSI containing double-byte character.Can you tell me how to fix it? (If this comment was disrespectful, please report it.)
|
12/6/2004 4:48:51 PM:
Nice code but i am trying to either change the file name to add a userid to the end to make it unique or to create a new directory for each user. Can you help me out please mate. I am using the fileupload to a directory not to a database. Thanks Chris (If this comment was disrespectful, please report it.)
|
12/7/2004 4:38:02 PM:
I seem to be getting the same error as the guy above... ADODB.Stream error '800a0bbc'
Write to file failed.
/ArtworkSupport/Uploads/Upload2/clsField.asp, line 178
This works locally and I have changed the permissions to this folder on the server as write. Is this correct?
Please advise, Thanks.
(If this comment was disrespectful, please report it.)
|
12/14/2004 3:19:13 PM:
lewis....this is a great piece of code.. i have been trying to figure out a method for uploading files using IE for a while..i am having the same problem as a few others here--o file system Error Type: ADODB.Stream (0x800A0BBC) Write to file failed. /uploadtest/clsField.asp, line 178..i thought this might be a permission problem but i can't seem to figure it out...thanks (If this comment was disrespectful, please report it.)
|
12/17/2004 11:44:17 AM:
The issue with the Write to file failed. /uploadtest/clsField.asp, line 178 is a permissions problem. You must make sure that the uploads folder has read/write permissions.
(If this comment was disrespectful, please report it.)
|
12/23/2004 12:38:32 AM:
Works great - a minor problem though. For some reason, it's not getting the filename (objUpload.Fields( (If this comment was disrespectful, please report it.)
|
12/23/2004 12:40:56 AM:
Works great - a minor problem though. For some reason, it's not getting the filename (objUpload.Fields("File1").FileName coming up blank). I am using ToDatabase.asp. (If this comment was disrespectful, please report it.)
|
1/9/2005 4:50:15 PM:
Does this coded work with xp-pro? (If this comment was disrespectful, please report it.)
|
1/12/2005 6:13:22 PM:
I have this set up for a local intranet and it seems to work fine for the windows users but wtih a mac browsing the page... when I try to upload a file I get the (If this comment was disrespectful, please report it.)
|
2/2/2005 4:42:01 PM:
The code worked fine in windows 2000 server. but it did not work in 2003 server. It is not uploading the files. Is there any setting that we should change in the server settings. pls let me know (If this comment was disrespectful, please report it.)
|
2/2/2005 4:46:27 PM:
The code worked in windows 2000 server but not in 2003 server. Not uploading the files. Iam not able to see the filename but I can see the file size and type. Is there anything to do with the settings on the 2003 server. Anybody's help will be appreciated. (If this comment was disrespectful, please report it.)
|
2/4/2005 10:16:26 AM:
Code works great for IE, but not for Mozilla based browsers. This is probably due to the ActiveX object it uses. Also, if anyone is interested in a method of retrieving form fields ALONG with the file, just email me at webdev(at)kritikal(dot)com and I'll hook you up. (If this comment was disrespectful, please report it.)
|
2/20/2005 1:40:57 AM:
Code works good, but when I try to get other types of form fields such as text or hidden field, it just does not work with (If this comment was disrespectful, please report it.)
|
3/4/2005 8:03:07 PM:
Hi, I got the following error. Microsoft VBScript runtime (0x800A0005) Invalid procedure call or argument: 'MidB'
I tried to upload more than 1 files (don't have to be 2) inside a loop but it doesn't work. Pls, let me know what's going wrong (If this comment was disrespectful, please report it.)
|
3/10/2005 4:03:03 PM:
I know this has been asked, but I see no resolve posted - I am uploading text files to the database, as well as (perhaps) Word files. Yet, once I try to download them, it tries downloading the Datafile.asp page. Please advise as to how to get it to recognize other file types. (If this comment was disrespectful, please report it.)
|
3/22/2005 5:52:06 PM:
Is uploading files in this way secure? Is there a way to encrypt the files before uploading? (If this comment was disrespectful, please report it.)
|
3/23/2005 2:53:32 AM:
I would just like to find out from you what are the changes that need to be made to the codes to allow us to retrieve multiple field values with the same name. I went thru the codes, but I simply have no idea where to start.
Any help would be greatly appreciated. Thank you.
Best regards,
Cody (If this comment was disrespectful, please report it.)
|
4/6/2005 10:34:02 AM:
Does anyone have a work around to get the code working in Mozilla based browsers? Running into a road block. (If this comment was disrespectful, please report it.)
|
4/8/2005 3:21:15 PM:
Hi, All! I analyzed code with Mozilla browser, only diferenc is that Mozzila returns only name of file beaing uploded (excel1.xls), IE return full path (c:\documents\excel1.xls). To make code work with Mozzila just change following code in clsField.asp: If Not InStrRev(pstrPath, "\") = 0 Then FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1) End If To: ' Parse File Name If Not InStrRev(pstrPath, "\") = 0 Then FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1) else 'PAP Mozzila FIX FileName = pstrPath End If
(If this comment was disrespectful, please report it.)
|
4/19/2005 3:39:41 PM:
My upload to database is working great but I'm having a tough time with uploading to the server. I added a folder in my web area called "upload" like the mappath and set the properties to allow uploads but it's not uploading my pdf to the server. Also, I noticed a couple of comments where I would like the answer but I'm not sure if you have to post your own question to get the answer. My second question is will this work with Windows 2003 server? Thanks, Anne (If this comment was disrespectful, please report it.)
|
4/28/2005 12:24:40 PM:
Thanks for the code. The code works great on 2000, but I am having problems on 2003 with files that are above a certain size or above. I have a submit button named submit, but when clicked,and a file is of only moderate size,
Upload.Fields( (If this comment was disrespectful, please report it.)
|
4/28/2005 12:27:46 PM:
The last line was cut off: Upload.Fields("Submit").Value is blank.
Because the clicked button controls when the upload occurs, my upload script no longer works.
Has Any one seen this?
Thanks in advance. Brian (If this comment was disrespectful, please report it.)
|
5/6/2005 6:19:24 PM:
A client of ours occasionally gets this error: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
C:\PRODUCTIONSITES\LOCALUSER\BOSPLACE\WWW\SECURE\EVENTS\UPLOADDOCUMENT\../.. /../includes /Upload/clsUpload.asp, line 79
Where line 79 is mbinData = Request.BinaryRead(mlngBytesReceived)
(If this comment was disrespectful, please report it.)
|
5/11/2005 7:54:34 PM: Kent Data Systems
I found 2 problems that were causing the good old Error Type: ADODB.Stream (0x800A0BBC) Write to file failed error - first one was in ToFileSystem.asp, you need to change strFileName = objUpload(0).FileName to strFileName = objUpload(0).FilePath The second one is in clsUpload.asp line 472 - just remark out Set Fields = New clsField. Then it works fine in Mozilla and IE! (If this comment was disrespectful, please report it.)
|
5/16/2005 11:05:27 AM:
Another little bug fix. This will enable users to loop through the Fields property in clsUpload.asp using a For...Next loop as shown in the notes at the top of the class file. Change line 449 from:
'Set Fields = mobjFieldAry(pstrName)
To: Set Fields = mobjFieldAry(llngIndex) Exit Property
(If this comment was disrespectful, please report it.)
|
5/19/2005 7:02:34 AM:
I tried using this code but i am having a problem. the (If this comment was disrespectful, please report it.)
|
5/19/2005 7:08:34 AM:
I tried using this code but i am having a problem. I am testing it on my local machine. The "Upload to Database" works fine with the sample database provided. However, the "Upload to File System" is not working. When I submit the form, even for very small files (less than 1kb), it is like the code is going into some kind of infinite loop and never ends. What is happening? Does anybody else have this problem? The permissions on the folder where I am uplpoading are given.
Thanks (If this comment was disrespectful, please report it.)
|
5/20/2005 6:24:29 AM:
Working with Kent Data Systems's very helpful fix above, I found Firefox started working but IE got stuck. But this seems to work:
If objUpload.Fields( (If this comment was disrespectful, please report it.)
|
5/20/2005 6:25:59 AM:
If objUpload.Fields("File1").FileName = false Then strFileName = objUpload.Fields("File1").FilePath Else strFileName = objUpload.Fields("File1").FileName End If
(If this comment was disrespectful, please report it.)
|
5/20/2005 6:30:04 AM:
By the way, thanks Lewis for the fantastic code! (If this comment was disrespectful, please report it.)
|
5/21/2005 4:31:42 PM:
I've been having problems to upload files greater than 10mb. I've looked for and I found that this could be a limit on the IIS buffer configuration. does any one had the same trouble and knows how to solve this ??? Thanks in advance (If this comment was disrespectful, please report it.)
|
5/24/2005 10:04:08 PM:
I'm getting following error at line 85 in clsUpload.asp. Would you please let me know what could be the issue. Thanks for your help.
Error Type: Request object, ASP 0206 (0x80004005) Cannot call BinaryRead after using Request.Form collection. (If this comment was disrespectful, please report it.)
|
6/16/2005 12:26:41 AM:
my applet does not load in IE nn or Mozilla Browsers. It loads in Appletviewer (of Visual Cafe). Kindly can you tell me the reason.
Regards Sudhir Venugopal (If this comment was disrespectful, please report it.)
|
8/15/2005 1:38:39 PM: Israel Balderrama
nice code man.. thanks a lot ***** (If this comment was disrespectful, please report it.)
|
10/6/2005 11:18:45 PM: mundo
works perfect,
does anyone knows how to pass some variables from text boxes to the ToDatabase.asp if we are using: encType="multipart/form-data"
to include some other information from text boxes to the data base.
Mundo
(If this comment was disrespectful, please report it.)
|
10/11/2005 10:35:07 AM: Alan
For anyone who comes across the error "Invalid procedure call or argument: 'MidB'" make sure you have enctype="multipart/form-data" in your opening html form tag (If this comment was disrespectful, please report it.)
|
11/5/2005 1:55:38 AM: harsh
i want to upload files of size upto 5mb to database. the code is wrking well for files of size upto 1mb or less but could not wrk for files of size more then 1mb. is thr any reason or this (If this comment was disrespectful, please report it.)
|
11/7/2005 11:55:57 PM: harsh
does anyone knows how to pass some variables from text boxes to the ToDatabase.asp if we are using: encType="multipart/form-data" to include some other information from text boxes to the data base. please give me the idea i will be thankfull (If this comment was disrespectful, please report it.)
|
11/15/2005 3:24:48 AM: littlepetto
Hi Lewis, great code!! Wonder if you have the code to delete the uploaded file on File System? Thanks :) (If this comment was disrespectful, please report it.)
|
11/22/2005 4:05:46 AM: Don Pasquale
thanks works perfect!
(If this comment was disrespectful, please report it.)
|
11/29/2005 8:32:54 AM: rob22202
Great Scripts!
The code below will create the destination folder, save the uploaded file, loop through all of the other form fields passed with the file and turn them into local variables:
Set objUpload = New clsUpload If objUpload.Count > 0 Then strFileName = objUpload.Fields("file").FileName upload_folder = "C:\uploads\" upload_path = upload_folder & strFileName Set objFSO = CreateObject("Scripting.FileSystemObject") If Not objFSO.FolderExists(upload_folder) Then Set objFolder = objFSO.CreateFolder(upload_folder) End If Set objFSO = Nothing objUpload("file").SaveAs upload_path For i = 0 To objUpload.Count - 1 TheString= objUpload(i).Name & "=objUpload(""" & i & """).Value" Execute(TheString) Next End If Set objUpload = Nothing
(If this comment was disrespectful, please report it.)
|
12/5/2005 5:21:52 PM: Andy
ADODB.Stream error '800a0bbc'
Write to file failed.
/Upload2/clsField.asp, line 178
This error was occuring on a 2003 server (hosted by Fasthosts - excellent tech supp), the problem seemed to be line 14 of the ToFileSystem.asp. I changed strPath = Server.MapPath("Uploads") & "\" & strFileName to strPath = Server.MapPath("/Uploads") & "\" & strFileName and it worked. Try putting a Response.write (Server.MapPath("Uploads") & "\" & strFileName) to test your server path. Hope that helps someone! :) (If this comment was disrespectful, please report it.)
|
12/7/2005 4:49:30 AM: manoj
i upload a file somefile.xls to folder and when i tried to upload the same file again i am getiing error in IE though i hv written the code to chk same file exists or not if exists i am throwing errror file alrady exist
Cannot find server or DNS Error Internet Explorer (If this comment was disrespectful, please report it.)
|
12/13/2005 1:20:01 PM: Stuart
Purvis Says: Your comment is awaiting moderation. December 13th, 2005 at 8:53 am Hi i have been using you upload asp code to database for a project I have been asked to do in school. I have hit a problem and hope you can help.
I need to add a field in the form that allows us to enter a description of the file upload this i can do the problem is how do i get your program to write that info also to the database as well as all the other stuff.
Thanks this problem is urgent if you can help I can be reached on emails below
rama1712@tiscali.co.uk or spurvis@hilbre.wirral.sch.uk
Thanks in advance Stuart ICT TECHNICIAN
(If this comment was disrespectful, please report it.)
|
12/13/2005 4:37:50 PM: john
hi, this is an awesome post. thank you. I keep getting an error saying 'operation not allowed' on clsupload line 176. I noticed this only happens when I try to upload large pdf files. Does anyone have a solution to this issue. Im using 2003 Server and IIS 6.0. Thanks (If this comment was disrespectful, please report it.)
|
12/14/2005 8:51:17 AM: Stuart
does the author of this software answer any of the problems (If this comment was disrespectful, please report it.)
|
12/29/2005 1:05:35 PM: Mike Hurst
anybody get this asp upload tool to work on mozilla or safari? It seems to work fine in internet explorer but i cant get it to work on a mac or with mozilla on a windows. Anybody get it to work?
Mike (If this comment was disrespectful, please report it.)
|
1/8/2006 11:57:13 PM: Ian
Hi Lewis, I think your code is great. I've had no problems uploading images to my filesystem. I added other fields and have been able to access them no problem. I seem to have an intermittant problem, I get a post data error '80020009'. I believe it has something to do with cache but can figure it out, can you help. (If this comment was disrespectful, please report it.)
|
1/17/2006 7:48:39 PM: testuser
A Possible Solution...
I have seen many people struggling with the error:
ADODB.Stream error '800a0bbc' Write to file failed. /test/clsField.asp, line 178
Using a Windows 2000 Server, I made sure that the "Uploads" folder had write permissions for the IUSR web account.
Secondly, the browser I am using is Firefox. No matter what I I did, (IUSR permissions or not), I kept getting the error. So... adding this to line 15 in ToFileSystem.asp:
Response.write (Server.MapPath("Uploads") & "\" & strFileName)
I discovered that the "strFileName" was NEVER returning with a value. So I entered this at line 12: strFileName = "test.txt" and EVERYTHING NOW WORKS.
I still have no clue why the original code for strFileName is returning blank after the form is submitted. (If this comment was disrespectful, please report it.)
|
1/23/2006 3:17:21 PM: nicola
Thanks for your upload code it works great!! Just wandering how you include getting new data from the same form as the one you are uploading from as Request.Form will created problems?
Thanks for your help with this. (If this comment was disrespectful, please report it.)
|
2/13/2006 11:58:31 AM: Bill
Regarding the comment above about "I discovered that the 'strFileName' was NEVER returning with a value."
I found that when I encountered this error, the filename was showing up in the FilePath (ala, objUpload.Fields("File1").FilePath). Not sure if it will always work, but I added a kludge to use the FilePath value if the FileName value is empty. The code now works in Mozilla. (If this comment was disrespectful, please report it.)
|
3/23/2006 2:01:23 PM: Terry West
Regarding the error message:
ADODB.Stream error '800a0bbc'
returned because strFileName was empty, I was able to fix this with the following code added to replace line 10 or 11 in toFileSystem.asp.
strFileName = objUpload.Fields("fileName2").Value
strFileName = strFileName & ".doc"
response.write strFileName & " "
In order to create the string to pass in "fileName2", I had created an extra input field in the Form. Also I added a line for the user to choose the type of file (.doc or .zip). Then I wrote code to add the file extension to the name before uploading it... you may want to modify that part depending on the type of files to be uploaded.
(If this comment was disrespectful, please report it.)
|
3/27/2006 3:03:11 AM: helmi
works fine. but does anyone know how to add other input element such as "text" where user can add email and name for this upload file? (If this comment was disrespectful, please report it.)
|
3/27/2006 3:40:30 AM: helmi
works fine. but do you have a solution for adding other input element such as text file where user can put their name and save into database, along with the uploaded file.
thanx (If this comment was disrespectful, please report it.)
|
4/4/2006 2:41:14 PM: bao
This code used to work but now I'm getting following error at line 85 in clsUpload.asp. Would you please let me know how to fix it. Thank you.
Request object error 'ASP 0206 : 80004005'
Cannot call BinaryRead
/clsUpload.asp, line 86
Cannot call BinaryRead after using Request.Form collection. (If this comment was disrespectful, please report it.)
|
5/24/2006 6:04:16 AM: Ancy
I tried ur code for uploading the files.ie, the files clsUpload.asp, clsProgress.asp and clsField.asp. I feel this is a very good code. I successfully uploaded files to my IIS path. But when I tried this in our remote server, I got the error ... Microsoft VBScript compilation error '800a0401'
Expected end of statement
/web/templates/clsField.asp, line 21
Public Property Get BLOB() ----------------^
Can u help me to fix this? It is very urgent for me.
Thanks in advance, Ancy. (If this comment was disrespectful, please report it.)
|
6/16/2006 11:52:39 AM: noviceforever
ADODB.Stream error '800a0bbc' Write to file failed. /test/clsField.asp, line 178
It works only in IE. I ran into the above error in firefox always. Also, the output folder needs to have write access by the internet guest account (IUSR) on the server. Lastly, i replaced server.mappath with physical location of the file. Dont know if that changes much, but it was one of the first things i tried to get the code to run and let it remain so. Scrolling above, i think am paraphrasing testuser ! But i missed his/her comment so i found this the hard way out :(
Hope this helps! (If this comment was disrespectful, please report it.)
|
6/26/2006 12:38:35 PM: martin
Had 5 hours at making this work... battling the good old error: ADODB.Stream error '800a0bbc' Write to file failed. /test/clsField.asp, line 178
I tried every tweak mentioned on this page (and there's quite a few). Perhaps typically, it was the LAST one that worked for me - replacing the server.mappath with the physical location. I tested the mappath & it was fine so I don't know why this fix worked! I'm just passing on the info for others getting the same error. Anyway, thanks to all the folks who've posted their experience & advice - I bet there's thousands who've found it invaluable. And of course thanks a million for this code in the first place - top work lewie boy! (If this comment was disrespectful, please report it.)
|
7/6/2006 6:54:25 PM: splendour_in_the_grass
For amatuer programmers like myself, to fix the problem:
'800a0bbc' Write to file failed. /test/clsField.asp, line 178
Like the previous comments, All you need to do is change the access privilege for the folder on the server console. I took me a day to work how to do this because I had no idea where the server console was located. For people using the IIS that comes with XP, just go to the window's(XP) control panel. Click on administration tools. Open Internet Information Servies, then expand the options in the left window, right click on your server name, go to properties, under the directory tab make sure read and write are enabled. That should fix the problem. (If this comment was disrespectful, please report it.)
|
7/11/2006 3:03:55 PM: JoltinJoe
Concerning: Microsoft VBScript runtime (0x800A0005) Invalid procedure call or argument: 'MidB'
I was getting this when objUpload.Fields("File1").FileName was empty. This can be happen with the demo files if you run ToFileSystem.asp or ToDatabase.asp directly. You have to run DEMO.asp and submit the form so that ToFileSystem/ToDatabase have a file to work with. (If this comment was disrespectful, please report it.)
|
7/13/2006 12:56:29 PM: ShAko
Request object, ASP 0206 (0x80004005) is a great code, i'm trying to use it and i got this error... could you help me??
Cannot call BinaryRead after using Request.Form collection. /training/clsUpload.asp, line 85
(If this comment was disrespectful, please report it.)
|
7/20/2006 5:49:37 AM: Oli
I have tracked the bug that causes the code to break on Mozilla browsers and have a simple fix for it. The code that returns the FileName at line 200 in clsField.asp. The problem is that it *requires* there to be a "\" in the file path. This is always true for IE browsers but Mozilla only returns the filename, not the full path and the filename.
Change the code from: ------------------------------- ' Parse File Name If Not InStrRev(pstrPath, "\") = 0 Then FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1) End If ------------------------------- TO: ------------------------------- ' Parse File Name If Not InStrRev(pstrPath, "\") = 0 Then FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1) Else FileName = pstrPath End If -------------------------------
Hope this helps everyone :) (If this comment was disrespectful, please report it.)
|
7/26/2006 4:19:34 AM: Eddy
The objUpload works fine, got all persmissions and the firefox fix. But when I add the line
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
to demo.asp I'm again confronted with the error:
ADODB.Stream (0x800A0BBC)
Write to file failed.
/paspup/aspupload/clsField.asp, line 178
For me it is vital to be able to upload files with ä,ö,etc in their names.
Any help is welcome! (If this comment was disrespectful, please report it.)
|
9/8/2006 12:16:34 PM: Nicodemas
For multiple file uploads, without being specific about field names in the backend logic, try doing a standard For...Next loop:
for x = 0 to objUpload.count - 1
if objUpload.Fields(x).filename <> "" then
objUpload.fields(x).SaveAs(path)
end if
next
This works because only file input form elements gives up a filename property. (If this comment was disrespectful, please report it.)
|
10/4/2006 2:04:11 AM: S.Ghanem-nia
Please HELP me! i'm running this code and get this error !!! :
Request object error 'ASP 0104 : 80004005'
Operation not Allowed
/test/Upload2/clsUpload.asp, line 85 File has been saved in database.
View this file: -------------------------- my file size : 274 KB and trying to Load to Database, Thank's
(If this comment was disrespectful, please report it.)
|
10/6/2006 7:34:55 AM: New Lines 1
I have made a slight change to the up load class
Step 1
' add line 74 Private mfileCount ' Number uploads STEP 2
' find ----- (around line 220) lobjField.Length = LenB(pbinData) lobjField.Value = "" ' ADD mfileCount = mfileCount + 1 End If
STEP 3 line 430 add Public Property Get fileCount() ' Return number of fields found fileCount = mfileCount End Property STEP 4 ADD 536 approx ' Set binary field count to zero mfileCount = 0
(If this comment was disrespectful, please report it.)
|
10/6/2006 7:36:29 AM: New Lines2
Dim objUpload
Dim strFileName
Dim strPath
dIM strFileDesc
' Instantiate Upload Class
Set objUpload = New clsUpload
for x = 1 to objUpload.fileCount
strFileName = objUpload.Fields("File_" & x).filename
strFileDesc = objUpload.Fields("Desc_" & x).value
if strFileName <> "" then
objUpload.fields("File_" & x).SaveAs(Application("FileDir") & "\" & strFileName)
Response.Write("" & strFileName & " saved to resources folder ")
Response.Write(strFileDesc & " ")
end if
next
Set objUpload = Nothing
New lines 3 to come
(If this comment was disrespectful, please report it.)
|
10/23/2006 9:28:30 PM: BC
Looks like some great work here... Quite a few tweaks from the 2002 files. Anyone have an updated *.zip file with the latest enhancements? Thanks in advance! (If this comment was disrespectful, please report it.)
|
11/2/2006 7:45:02 AM: Prathap
Hi, I am new to ASP, and I used your code for uploading files to server. I tested your code in my computer using localhost, and it is working great, uploading all files to "C:\Inetpub\wwwroot\MyWeb\Upload_Files2\Upload2\Uploads". I run same asp page from my server (www.tules.in) , after uploading it is displaying that file is upload to server(upload folder). But there are no files present in that folder. Please someone advice me. Regards, Prathap (If this comment was disrespectful, please report it.)
|
11/14/2006 9:15:40 AM: Kid
What happens is they get stored in the Microsoft Access file and their file name and everything is stored in there with them. But what I want to know is I'm trying to use it but I don't want to save it to Microsoft Access, I just want the files to go to the Upload folder. How do I do this? (If this comment was disrespectful, please report it.)
|
11/22/2006 11:00:18 AM: HackMaster
I'm getting a very strange error from this script. The clsUpload page is returning an "Invalid procedure call or argument: 'MidB'" error on the above referenced line 102, which is line 96 in the modified code I've got. But, the problem seems to occur very randomly. Sometimes it works perfectly and sometimes it errors out. I can't determine a constant that's causing the problem. Here's what I do know:
1) Any number of files can be uploaded (from 1 to 10000). 2) I loop through the fields using a "For i = 1 to objUpload.Fields("fieldNum").value ... Next" loop 3) The file fields are not being left blank. The files being uploaded do exist on the defined source. 4) There are no other form fields being submitted other than file fields. 5) The upload is taking place over an SSL connection. 6) The problem is not limited to a file type nor file size. File size limit in IIS is set to 256 MB. Average total size of files uploaded through this script < 2MB.
Please help!
(If this comment was disrespectful, please report it.)
|
1/8/2007 3:38:28 PM: ozzii
How do you use the script to retreive values from a multiple select list box? Sample code would be appreciated asap. (If this comment was disrespectful, please report it.)
|
1/12/2007 5:49:06 PM: Wil
I'd recently needed a simple way to upload images to my shared windows server. I downloaded this code, but ran into a couple of issues.
My form posts to itself, so I had to combine my form with the toDatabase.asp file. In doing so, I received an error message when I first loaded the page, saying that there was an Invalid procedure call or argument: 'MidB'. To solve this, I went to line 102 on the clsUpload.asp file and changed...
mstrDelimiter = MidB(mbinData, 1, InStrB(1, mbinData, CRLF) - 1)
To read...
if (Len(mbinData) > 0) then mstrDelimiter = MidB(mbinData, 1, InStrB(1, mbinData, CRLF) - 1) end if
Checking first to see if there was a value in mbinData seemed to reslove the issue. Once I got that error to go away, I encountered a more difficult issue to figure out. I'll try and post it after this one. (If this comment was disrespectful, please report it.)
|
1/12/2007 5:50:33 PM: Wil
Whenever I would submit the form, my regular variables would come across fine, but the variables for my file upload were coming across incomplete. FileExt still worked, but not FileName. To solve this, I went to line 201 on the clsField.asp file and changed...
If Not InStrRev(pstrPath, "\") = 0 Then FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1) End If
To read...
If Not InStrRev(pstrPath, "\") = 0 Then FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1) else If Not InStrRev(pstrPath, ".") = 0 Then FileName = pstrPath End If End If
The reason being, that the code expected a string that looked something like this; C:\Documents and Settings\lmoten\Desktop\Photo.gif, but in actuality it was only receiving this; Photo.gif. The added code allows the script to function normally, but if there is no full path and yet there happens to be a filename, then the script now uses that filename and alleviates the problem I was getting where no filename was being received. (If this comment was disrespectful, please report it.)
|
2/5/2007 5:23:03 AM: Tat
Dear Lewis, Just curious about how did you manage to overcome the IIS metabase AspMaxRequestEntityAllowed barrier. Another free ASP upload script package requires the user to change that variable's value (by the server's admin) to a bigger value before the package can work. (If this comment was disrespectful, please report it.)
|
2/23/2007 7:05:14 AM: David
Hi Lewis, Great code thanks. I am having a peculiar problem with IE7. On my machine I can only upload tiny files with this code to remote web server using IE7. The code works fine when uploading to IIS sites on my local machine, and works fine from my machine on Firefox with any file sizes. It also works fine on colleagues machine on identical version of IE7 with same security settings etc. Might be time to reinstall IE on my machine. If you had any thoughts re any possible reg settings or something that might explain this I would appreciate feedback. Thanks, David (If this comment was disrespectful, please report it.)
|
3/1/2007 5:18:56 PM: swcomm
Hi - I must be dim - this worked great until I added one new text field to the db + form + ToDatabase.asp. Now get error "Object doesn't support this property or method". What am I doing wrong? Thanks. (If this comment was disrespectful, please report it.)
|
5/1/2007 1:09:14 AM: Gafs
Thank you so much for the code. It help me alot! Thank you! (If this comment was disrespectful, please report it.)
|
1/27/2009 3:28:33 PM: Francisco Montero
I have added the following code to get the field name passing the index.
Public Property Get FieldName(ByVal pIndex) If pIndex > mlngCount - 1 Or pIndex < 0 Then ' Raise an error Call Err.Raise(vbObjectError + 1, "clsUpload.asp", "Object does not exist within the ordinal reference.") Exit Property End If FieldName = mobjFieldAry(pIndex).Name End Property
Use: For i = 0 To objUpload.Count - 1 response.write objUpload.FieldName(i) Next
(If this comment was disrespectful, please report it.)
|
6/30/2009 10:47:09 AM: David Fu
Lewis, you uploading code is amazing. It works so well with our application. However recently, we encountered an issue with uploading an Excel 2007 .xlsx file. The file is being able to uploaded successfully. However, when I tried to open it on the server with Excel 2007 installed, there is an error message: "Excel found unreadable content in .xlsx file. Do you want to recover the contents of the workbook?"
Thanks for your help in advanced!!! (If this comment was disrespectful, please report it.)
|
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
To post feedback, first please login. |