Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Upload Error: Cannot call BinaryRead

Status
Not open for further replies.

Rachel80

Programmer
May 25, 2000
63
GB
Hi,

I'm using a sample (upload.asp) downloaded from to try uploading files to a specified folder..
The sample works fine but not after integration with my code :-(

I get the following error:

Request object error 'ASP 0206 : 80004005'
Cannot call BinaryRead
/391cs/upload.asp, line 46
Cannot call BinaryRead after using Request.Form collection.

If it can call the BinaryRead previously from the sample file, and why not now? I have not changed any codes in the upload.asp that i downloaded.. I did the same by including it in my asp file with uploading codings. Pls help!

THanx,
Rach :-8
 
while testing the downloaded sample, i used different folder.. i did not use back that same folder and it shouldn't matter if i use different files too..
 
The BinaryRead method is used to retrieve the data sent to the server from the client as part of a POST request. It will store the data in a safe array (an array that stores information about the number of dimensions and the bounds of its dimensions).

Note: A call to Request.Form after a call to BinaryRead, and vice-versa, will cause an error as noted in the following link:



Access your form variables as follows
Uploader.Form("your From variable")
 
my problem here is:

When i use <form enctype=&quot;multipart/form-data&quot;>,
image can be uploaded but all form request variables return blank (or null?). Thus i remove &quot;form-data&quot;.. Now form.request works, but uploaded file could not be read, thats why i have this error &quot;cannot call BinaryRead&quot;. Please help! I just want to upload images and update database fields thats all.. Shouldn't have problems right? :-(
 
I have worked with the above files before.
The code parses the form variables out for you using the BinaryRead method.

instead of using request.form(&quot;formdataname&quot;)
use Uploader.Form(&quot;FormDataName&quot;) .

This has to be done after the following statement
Uploader.Upload()
Once this method is called the the form data can be accessed using the following syntax

Uploader.Form(&quot;FormDataName&quot;) instead of
request.form(&quot;FormDataName&quot;)

 
oh yes.. Uploader.Form does work, thanx!

however, now there is another problem :-(
When updating the form with text fields and &quot;file&quot; fields,
I cannot check if the user has input any value in the <input type=&quot;file&quot; name=&quot;file1&quot;>
i then use Uploader.Form(file1) to get the value
but it is always blank or empty spaces regardless i browse file anot.. Pls help!
 
in another words, I need to validate the field <input type=&quot;file&quot; name=&quot;file1&quot;>: if there is value or input from user, then update in database, else no need to update and upload image (since there is not input from user)

by the way, upload files function is restricted to any file type?? I need to upload image and html files, should not have problem right?
 
Yes validate the field on the client side prior to uploading.
I think the script on the page will check for a file and if there is none present, it won't upload anything.

No it is not restricted.
 
1) i just realised that IE and Netscape recognise the image path differently?? one allows virtual path whereas the other requires absolute path..??

2) the prob i have been facing is because I'm using Netscape! When i tested with IE the file uploads properly and with the validation. Netscape cannot support VBScript?

Using the sample Uploader(), which is VBScript, does that mean i can only use IE to perform file upload?
 
1) The images should path should not be a problem since your are using a standard input box to get the path to the file.

2)True

3)The vbscript is on the server and not on the client. so that should not matter. What does matter is if netscape impeds the file as binary code the same way IE does. If it does then the code should work. But if the way netscape sends the file to the server is different you will need different code to get the file back out on the server.
 
bcoz Netscape does not check for the number of files uploaded.. cannot validate :-( so i suspected its Netscape prob since it does not support VBScript.
 
Are you trying to validate the file input field on the client?
 
yes, when the user on client side has input the file to upload or not.. the VBScript cannot get the right value of no. of files uploaded (in Netscape)
 
I need server side validation for checking against the value in a database..
 
File Upload - How Did you get this to work?

I'm running into the same binary problems however when I ran the Uploader.Form(&quot;&quot;) nothing appeared. and the file was not recognized.
 
did u use <form enctype=&quot;multipart/form-data&quot;> ?
then the next page that requests the form variables are
using Uploader.Form(&quot;samplefile&quot;), instead of Request.Form(&quot;samplefile&quot;). It causes the binary problem (in my case because i did use request.form for the other fields)..
 
Hi Thanks for the response. I did forget to put the form enctype and also forgot the Uploader.Upload. I have the saving of the file section working pretty good. However now I have to save data to the database. Specifically the file name I just uploaded. My database is outside the For loop. I really have no idea how to get the file name for this uploaded file.

I was thinking of maybe using the filesystemobject, but I don't know which method I could use. Any ideas.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top