We help IT Professionals succeed at work.

Uploading file to web server using ASP

1,003 Views
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
Comment
Watch Question

Commented:
lets see your code. can u post it here ?

Author

Commented:
requestFname = request.querystring("fname")

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

Commented:
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

Author

Commented:
Yes, sorry it was a typo

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

Author

Commented:
still have the same problem

Commented:
why dont you post your full code ?

or just try free script from
http://www.asp101.com/articles/jacob/scriptupload.asp

Author

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

Author

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

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.

OR

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.