'Not getting File value in Create action in MVC
I have a problem while uploading a File to a DMS server..I seem to not get value from a File label on my Insert page, I would be thankful for a suggestion or answer..
Here is my Create_Form
@model InsertDbProcedure
<div class="form-horizontal">
<div class="form-group">
@Html.LabelFor(model => model.IP_FILETYPE, new { @class = "control-label col-md-2" })
<div class="col-md-1">
@Html.EditorFor(model => model.IP_FILETYPE)
@Html.ValidationMessageFor(model => model.IP_FILETYPE)
</div>
@Html.LabelFor(model => model.File, new { @class = "control-label col-md-2" })
<div class="col-md-5">
@Html.EditorFor(model => model.File)
@Html.ValidationMessageFor(model => model.File)
@Html.ValidationMessageFor(model => model.FileName)
@Html.ValidationMessageFor(model => model.NewFileName)
</div>
</div>
</div>
<script>
const myFileForm = $('#File')[0].form;
$(myFileForm).attr('enctype', 'multipart/form-data');
</script>
and here is where i get error in my controller
Stream fileSteam = form.File.InputStream;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
