How to send binary multipart formdata as base64?

Possible duplicate:
How can you encode Base64 using Javascript?

I have a web application based on Java, Wicket and JQuery that has a function that allows users to upload files (images, pdfs, rtf) via multipart / form-data.

Our web security infrastructure filters out all HTTP traffic to get potential malicious content, for example. XSS attacks, SQL injection, buffer overflow, etc.

The filter does not distinguish between normal text input fields and file data, so it selects false positives from many downloaded binary files, preventing them from loading. I cannot change the security policy.

It seems that the best way to do this would be for the file data to be encoded in base-64, so they are sent with Content-Transfer-Encoding: base64, similar to what email clients do.

Is there a way to direct the browser to migrate the binary as base64 or some other non-binary format?

If not, can this be done manually using JavaScript?

+5
javascript jquery html wicket
source share
1 answer

It seems you can set Content-Transfer-Encoding: base64
quote from W3C:

Each part can be encoded, and the heading "Content-Transfer-Encoding" is indicated if the value of this part does not correspond to the default encoding (7BIT)

http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2

If your Java web server does not use the Content-Transfer-Encoding parameter.

+2
source share

All Articles