Possible Duplicate:
How can you encode to Base64 using Javascript?
I have a web application based on Java, Wicket and JQuery which has a function to enable users to upload files (images, pdfs, rtf) through multipart/form-data.
Our web security infrastructure does filtering of all http traffic to pick up possibly malicious content e.g. XSS attacks, SQL injection, buffer overruns etc
The filter doesn't distinguish between normal text input fields and file data so it picks up false positives from many uploaded binary files, preventing those files from being uploaded. I cannot change the security policy.
It seems the best way around this would be for file data to be base-64 encoded so that it is sent with a Content-Transfer-Encoding:base64 similar to what email clients do.
Is there any way to direct the browser to transfer binary as base64 or some other non-binary format?
If not, could it be done manually with some JavaScript?
It seems that you can set Content-Transfer-Encoding: base64
quote from W3C:
Each part may be encoded and the "Content-Transfer-Encoding" header supplied if the value of that part does not conform to the default (7BIT) encoding
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
Provided your Java Web Server in use doesn't ingore parameter Content-Transfer-Encoding
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With