Ajax File upload

Last post 01-30-2009 5:18 PM by gunteman. 1 replies.

Sort Posts:

  • Ajax File upload

    01-30-2009, 4:53 PM
    • Member
      3 point Member
    • mmercure
    • Member since 12-11-2008, 5:57 PM
    • Posts 5

    I'm trying to uplaod a file using

      <%
        using (Ajax.BeginForm("LoadFile", new AjaxOptions { }))
        {
    %>
    <input type="file" is="Fichier" name="fichier" />
    <%
        }
    %>

     and in my controller Request.Files is always empty. If i change to Html.BeginForm, the file is uploaded fine...

    what am I missing?

    thx

  • Re: Ajax File upload

    01-30-2009, 5:18 PM
    Answer
    • All-Star
      21,648 point All-Star
    • gunteman
    • Member since 07-11-2007, 8:57 AM
    • Norrköping, Sweden
    • Posts 3,177

     Files can not be uploaded using AJAX. The XmlHttpRequest doesn't support it (for very valid security reasons). You will have to use something like SwfUpload or upload inside an iframe to simulate it.

    -- "Mark As Answer" if my reply helped you --
Page 1 of 1 (2 items)