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.