tags:

views:

227

answers:

2

I need to read the binary data (a file that is uploaded) from a form that is posted to a classic asp page. I need to do this without using a component.

How do you read the binary data for that specific file? Note that there could be other non binary fields that need to be read as well.

(updated to clarify)

+1  A: 

Use Request.BinaryRead method:

byteSafeArray = Request.BinaryRead(Request.TotalBytes)
Mehrdad Afshari
and how would you retrieve a specific input field?
Derek Ekins
That's a bit more complicated. See: http://www.asp101.com/articles/jacob/scriptupload.asp for a pure ASP solution.
Mehrdad Afshari
@Derek: I think you'll have to read RFC2388 and construct a multipart/form-data parser - IIRC there's no other way to do it without a component: http://tools.ietf.org/html/rfc2388
NickFitz
Thanks Mehrdad, the asp upload script did the trick. Much nicer solution than using a component too.
Derek Ekins
+1  A: 

Another alternative is to use clsupload. It is pure ASP and does not use any components.

Read here for everything you need to know about it:- CLS UPLOAD

I have used this in the past and it is still being used today on some of my old sites.

Rippo
+1. Yep thats how it is done.
AnthonyWJones