We help IT Professionals succeed at work.

Uploading file to web server using ASP

Last Modified: 2009-08-05
Request.Binaryread   throws error-  007~ASP 0101~Unexpected error~The function returned |.   I tried different approaches but it always fails in binary read method, it seems system is not able to handle the memory allocation,  I dont see any size  restrictions in the binaryread documentation. I am able to upload the file 65 mb just fine. I changed the metabase.xml to upload up to 2 gig, its windows 2003 server
If I directly write request.totalbytes to log file the byte count is correct
when i do this binread = request.TotalBytes the number of bytes in binread is incorrect

its fails here - ado_stream.Write request.BinaryRead(request.TotalBytes)

Please help..I am just cant figure out waht going wrong
Watch Question

lets see your code. can u post it here ?


requestFname = request.querystring("fname")

set ado_stream = Server.CreateObject("ADODB.Stream")
   ado_stream.Type = 1  ' 1=adTypeBinary
   ado_stream.Write request.BinaryRead(request.TotalBytes)   - It fails here
  ado_stream.SaveToFile server.MapPath("\Temp\cache\") & "\" & requestFname ,2
   set ado_stream = Nothing

ado_stream.SaveToFile server.MapPath("\Temp\cache\") & "\" & requestFname ,2
did u try to change it to :
ado_stream.SaveToFile server.MapPath("\Temp\cache\") & requestFname ,2


Yes, sorry it was a typo

but wats the outcome ? still have same problem or it is fixed ?


still have the same problem

why dont you post your full code ?

or just try free script from


I tried ur suggestion but stlll the same error mesage 007~ASP 0101~Unexpected error~The function errored out  at reuqest.binaryread


anybody with ideas please
Unlock this solution and get a sample of our free trial.
(No credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.