title: How to add base64 encoded files to simple javascript form?
body: <p>I have N files in base64 format inside an object and a simple form like so:</p>
  
  <pre><code>var files = {
      'foo.pdf': 'JVBERi0xLjMKJcTl8u...',
      'bar.pdf': 'JVBERi0xLjUNCiWCiU...'
  }
  
  var form = document.createElement('form');
  form.name = 'stupidInternetExplorerFixForm';
  form.method = 'POST';
  form.action = config.API_URL + '/foobar.pdf';
  
  function appendField(key, value) {
     var tmp = document.createElement('input');
     tmp.type = 'HIDDEN';
     tmp.name = key;
     tmp.value = value;
     form.appendChild(tmp);
  }
  
  appendField('foo', 'foo');
  appendField('bar', 'bar');
  //appendField('files', files); -- HERE. What do I do here?
  
  document.body.appendChild(form);
  form.submit();
  </code></pre>
  
  <p>This form will always return a file. How do I add the files to my form programmatically? This has to work with IE9 and above. Changing the content-type is potentially possible, but I'd like to avoid it if possible. Backend is Java (Spring) and all kind of trickery there is no problem.</p>
  
  <hr>
  
  <p>EDIT: Ajax file download is not an option at this point, it was already attempted before this method was tried. Basically I am actually creating a fallback option for ajax file downloads with multiple file uploads inside it. <strong>The solution</strong>: Upload the files as dynamic text fields instead of actual real files. Then in the backend convert them into files again.</p>