Fetching file path from file upload control in mvc using jquery is not working in FIREFOX

I have an mvc textbox control and fileupload control as shown in the image. and here is the markup and js code and the action method....

<div>
<div>
    <input type="text" id="txtusername" /></div>
<div>
    <input type="file" id="fileupload" /></div>
<div>
</div>
<div>
    <input type="button" id="btnsubmit" value="update/submit" onclick="fnupdatedetails(this)" /></div>

  [HttpPost]
    public ActionResult UpdateDetails(FormDetailsBE formDetailsBE)
    {
        return View();
    }

    public class FormDetailsBE
    {
        public string UserName { get; set; }
        public string FileUpload { get; set; }
    }

Here is the js code...for IE which is fetching the file path correctly

Here is the js code... for firefox which is not fetching the file path

the same js code acting differently in diff browsers... some one please help. i'm stuck. Thanks in advance.

Answers


That's not allowed for security reasons. The client side file path is never sent to the server. There was a bug in older versions of Internet Explorer where this path was sent but in new versions but this bug is fixed in the recent version. The server shouldn't need to know the file path on the client computer.


Need Your Help

USB Serial cable with CDC support

hardware usb driver cdc usbserial

I bought a USB to Serial cable which claims to be CDC compliant.

AcceptChanges cannot continue because the object's key values conflict with another object in the ObjectStateManager

c# asp.net-mvc entities

The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: