jquery - How to upload file using ajax.beginform in asp.net MVC -


my view:

using (ajax.beginform("create", "customerengagement", null, new ajaxoptions { onsuccess = "closepopupandshownextpost", insertionmode = insertionmode.replace, httpmethod = "post" }, new { @id = "create" })) {     // lots of things going on here      // need implement fileupload upload attachments asynchronously here      <input name="fileupload1" id="fileupload1" multiple type="file" />     <button id="fileupload" name = "upload">     //button submit form     <button id="save" value="save"> } 

controller :

[httppost] public actionresult create(string word, studentmodel model) {     list<string> synonyms = new list<string>();     list<string> sugg = new list<string>();     //doing lot of stuff here     // i'm trying httppostedfilebase here null, request.files[] coming null.  } 

i think in ajax.beginform file not uploaded, can have other solution here?

basically cannot upload using ajax not supported, can use plugins such ajax upload , uploadify. many of found here: http://www.sitepoint.com/10-jquery-ajax-file-uploader-plugins/

you can follow tutorial: http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -