Setting a file upload field value - Javascript/jQuery
<p>I have a form page that has a file upload field and I am trying to set the value of that field programmatically and although I know that it isn't possible due to security reasons, I would like to know if we still can? If there is a plugin or something that I could use to perform the upload. I have the Base64 value of the file field that is required to set that field, all I need to know is if there is a way to set it.</p>

<p>Any suggestions or help would be great in this regard.</p>

<p>Thanks.</p>

<p><strong>Update:</strong>
Added a JsFiddle to demonstrate what I'm trying out.</p>

<p>Please visit this website to create a text file using the example in the js fiddle and convert it using this link.</p>

<pre><code>var str = `text`;
</code></pre>

<p><a href="http://www.motobit.com/util/base64-decoder-encoder.asp" rel="nofollow noreferrer">http://www.motobit.com/util/base64-decoder-encoder.asp</a></p>

<p><a href="https://jsfiddle.net/rccfymrz/10/" rel="nofollow noreferrer">JsFiddle</a></p>

<blockquote>
  <p><strong>Note:</strong></p>
  
  <p>The answer(s) below reflect the state of legacy browsers in 2009. Now you can actually set the value of the file input element dynamically/programatically using JavaScript in 2017.</p>
  
  <p>See the answer in this question for details as well as a demo:<br><a href="https://stackoverflow.com/q/47515232/584192">How to set file input value programatically (i.e.: when drag-dropping files)?</a></p>
</blockquote>