javascript - How to get HttpPostedFileBase to work with Ajax.BeginForm? -


i'm trying use ajax.beginform httppostedfilebase upload files. in trying trace issue i'm using rendered version of form element.

i'm using exact same code in 2 applications. dummy program has nothing code, , actual application in want embed file upload code. in dummy app ajax code works sending file controller. in actual corporate application, code works if data-ajax="true" left off, otherwise attachmentfile null. so, works html form submit. doesn't work ajax submit.

can give me clue why httppostfilebase works ajax in dummy mvc solution, not in full blown corporate application?

i've spent couple of days in stack overflow , trying different things in application. nothing has worked. i'm asking help, if has experience setting in project stops httppostfilebase working ajax.

_layout.cshtml     <!doctype html>     <html>     <head>         <meta charset="utf-8" />         <meta name="viewport" content="width=device-width, initial-scale=1.0">         <title>@viewbag.title - asp.net application</title>         @styles.render("~/content/css")         @styles.render("~/content/app")         @rendersection("scripts", required: false)     </head>     <body>         <div>             @renderbody()         </div>         @scripts.render("~/bundles/jquery")         @scripts.render("~/bundles/jqueryui")         @scripts.render("~/bundles/bootstrap")         @scripts.render("~/bundles/app")         @scripts.render("~/bundles/modernizr")     </body>     </html>  index.cshtml         @{         viewbag.title = "web6 home page";     }     <form id="form0" action="/home/index" enctype="multipart/form-data" method="post" novalidate="novalidate" data-ajax="true" >         <input name="attachmentfile" type="file" />         <input id="fileuploadbtn" type="submit" value="upload" />     </form>  home.cs         [httppost]     public actionresult index(httppostedfilebase attachmentfile)     {         //if (attachmentfile.contentlength > 0)         //{         //    var filename = path.getfilename(attachmentfile.filename);         //    var path = path.combine(server.mappath("~/app_data/uploads"), filename);        //    attachmentfile.saveas(path);        //}         return redirecttoaction("index"     } 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -