title: How to send binary multipart formdata as base64?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/246801/how-can-you-encode-to-base64-using-javascript">How can you encode to Base64 using Javascript?</a>  </p>
  </blockquote>
  
  
  
  <p>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. </p>
  
  <p>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</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Is there any way to direct the browser to transfer binary as base64 or some other non-binary format?</p>
  
  <p>If not, could it be done manually with some JavaScript?</p>