tags:

views:

23

answers:

2

i am using jquery form plugin for file upload . i am not able to get file in the controller . what could be wrong.

    public string CreateOrganizationMeta()
    {
        foreach (string file in Request.Files)
        {
            HttpPostedFileBase postedFile = Request.Files[file];
        }

}

 $(document).ready(function () {
  $('#MyForm').ajaxForm({

     });      
 });


      <% using (Html.BeginForm("Organization", "CreateOrganizationMeta", FormMethod.Post, new { id = "MyForm", enctype = "multipart/form-data", onsubmit = "return submitForm2(this)" }))
     { %>
        <input type="file" name="Logo2" id="Logo2" />

<% } %>

A: 

I don't think you can upload files using ajax. There are some workarounds for this though.

Try googling for file uploads with ajax

Simon Hazelton
A: 

The documentation for this plugin states that it supports file uploads.

I've used Andrew Valums' Ajax Upload on several projects and it works great. May be an alternative to consider.

David Hoerster
will work well with asp.net mvc ?
mazhar kaunain baig