views:

44

answers:

1

Any ideas how file uploading and (simple) parsing can be done through pure ASP? I have various upload scripts, but they all either save a file to a folder or in a database. I can't seem to modify these examples correctly to put the file in an array.

Here's the 2 scripts that I'm currently using:

A: 

Uploads are sent back to the server as multipart/form-data. If the file is binary, it's going to be base64 encoded.

The sample you linked to (clsUpload) is a class that dissects the multipart form data, reads all of the header info for each uploaded part, and gives you some nice abstracted facilities to de-base64 the data and write it to the file system or a database. In fact, the ASCII2Bytes() function in clsField.asp converts the data to a byte array and the SaveAs() function loads that byte array into a stream and then saves it out to the file system. All you need to do is add a function that converts to a byte array in the same fashion but just return the byte array instead of writing it to a file. The code is essentially there already, you just need to rearrange it a bit.

pjabbott
Hoping you can clarify something. Would I still use the ADO stream to return the byte array. If so, which ADO method should I use?
Allen
I don't do ASP, but you seem to insinuate that binary `multipart/form-data` items are implicitly base64 encoded. This is totally not true. The average webbrowser doesn't do that.
BalusC