Skip to content Skip to sidebar Skip to footer

How To Fake Ajax File Upload?

I've an upload form I would like to populate with a file, in particular an image. My understanding is that I need to create a File object to put in the FileList of the relative for

Solution 1:

Use a regular form and target it to an iframe with display set as none.

<form id="my_form" enctype="multipart/form-data" action="upload_handler.php" method="POST" target="upload_target">
   <input name="uploadfile" type="file" />
   <input type="submit" value="Upload File" />
</form>
<iframe id="upload_target" name="upload_target" style="display:none;"></iframe> 

Post a Comment for "How To Fake Ajax File Upload?"