c# - File uploading in MVC -
i have form it's creating script in jquery plugin this.
elem.inserthtml('<form method="post" action="home/contactus" enctype="mutlipart/form-data"><input type="file" name="file" id="fileupload"></form></div>')
i must upload file, , save in folder. when choose file, , submit form, on form subbmiting calling contactus action.there contactus action home controller.
public actionresult contactus(httppostedfilebase file, contactformmodel model) { //other code }
but httppostedfilebase file null, , havn't got notions why. can me, please?
when create form usin html.beginform, works correctly, script there problem.
you can use 'file' method uploading file , retrieve them. create folder in project likes 'fileuploads' , upload file in there. give link can see full implementation :- upload,save , retrieve image database using id in code first method
Comments
Post a Comment