I am trying to return a file to the client browser. To avoid any problems caused by binary to character conversion, I'm not using FILETOSTR(). Instead, I encode the file to base64, then add a http header to say that the file is encoded in base64 and send the file to the browser.
Unfortunately, it does not seem to work properly, the browser simply saves the file as the base64 encoded version, rather than decoding it and then saving the file. What to do ? Thanks for any help you can provide.
Here is my code:
*/' Set up the base64 library in order to encode the file.
oBase64 = createobject("Base64Lib.Base64")
*/' Base64 encode the file to string
lcFileContent = oBase64.EncodeFromFile("c:\transfer\test.pdf")
*/' Specify file name in the http header.
Response.AddHeader("Content-Disposition", "attachment; filename=test.pdf")
*/' Specify size so that the browser's progress bar works properly
*/' Specify the type of encoding used, so the client knows how to decode.
Response.ContentType = "application/pdf"
*/' Send file to browser.
*/' Release the base64 object.