For testing purpose:
According to the W3C File API specification, it's possible to create a file object:
var dynamic_file = new File(["file_content_foo"], "filename.txt");
But how to link it to the input file?
<input type="file" id="file_to_upload"/>
<input type="submit" value="post">
The goal: Sending the post will send the dynamic_file