Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want a upload a file but no parameter value why?

HTML
@using (Ajax.BeginForm("addfilezamimeh","letter", new { id = 90 }, new AjaxOptions { HttpMethod = "post", UpdateTargetId = "divAjax", InsertionMode = InsertionMode.Replace }, new { enctype = "multipart/form-data" }))
{                                             <input type="file" id="filex" />
                                             
                                            <input type="submit" value="nnnnnnnnnn"  />           
                                           <div id="divAjax"></div>
                        
}   



C#
 [HttpPost]
        public ActionResult addfilezamimeh(int id,HttpPostedFileBase filex)
        
        {
            
          
            foreach (string upload in Request.Files)
            {
}
}
Posted
Updated 17-Mar-15 3:11am
v3

1 solution

You can't upload files using ajax like that. Google "c# mvc async upload" for some possible solutions. You can do this using various javascript plug-ins or using html5, but you can't do it using basic jQuery ajax (which is what Ajax.BeginForm uses).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900