What is enctype="multipart/form-data" during FileUplod and Why we use HttpPostedFileBase in MVC? [Resolved]

Posted by Kumarkrishna184 under ASP.NET MVC on 12/11/2015 | Points: 10 | Views : 781 | Status : [Member] | Replies : 3
What is enctype="multipart/form-data" during FileUplod and Why we use HttpPostedFileBase Class in MVC?

Thanks and Regards,
Krishna Kumar



Responses

Posted by: Sheonarayan on: 12/11/2015 [Administrator] HonoraryPlatinum | Points: 50

Up
1
Down

Resolved
enctype="multipart/form-data" is encryption type specified in the <form> within which we keep the FileUpload element (<input type="file" />). As the file content is binary format and that is different than plain text format so enctype attribute is specified in the html form to indicate the server that the data that is being sent is not only text but also binary data.

ASP.NET MVC has it's own way of interpreting File element in the action method, all the necessary properties and method of File element is added to the HttpPostedFileBase class when the asp.net mvc form is submitted to the action method of the server.

If you are looking for tutorials on how to upload file on the server in asp.net mvc, read this post http://techfunda.com/Howto/asp-net-mvc/281/upload-file-on-server.

Hope this helps.

Thanks


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kumarkrishna184 on: 12/11/2015 [Member] Starter | Points: 25

Up
1
Down
Thanks Sir...

Thanks and Regards,
Krishna Kumar

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajnilari2015 on: 12/11/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
Please refer: http://www.prideparrot.com/blog/archive/2012/8/uploading_and_returning_files#httppostedfilebase

--
Thanks & Regards,
RNA Team

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response