Goal:
I would like to have the second input name "file2" to be uploaded automatically to the actionresult with support of the jquery code using the latest version of FF, CHrome and IE.
Problem:
It doesn't work because HttpPostedFileBase file2 is null. it is supposed to be contain any value based on uploaded file with support of jquery.
Info:
*It would be great that it would be working for IE, Chrome and FF.
*There is a purpose why I'm asking about this unusual approach.
*The sourcecode of jquery and html work only for FF.
Thank you!
$("#file1id").change(function () { if($('#file2id').length){ $('#file2id').remove(); } $(this).clone().attr('id', 'file2id').insertAfter($(this)); });
<input id="file1id" name="file" type="file" accept=".xml, .txt" /> <input id="file2id" name="file2" type="file" accept=".xml, .txt" />
public ActionResult UploadShipments(HttpPostedFileBase file, HttpPostedFileBase file2) { --- }
https://jsfiddle.net/ayd4x079/2/