Вы правы. Ред. Извиняюсь.
от вопрос уже есть ответ здесь:
HttpPostedFileBase всегда возвращает ноль в ASP.NET MVC 5 ответовя возиться с загрузкой файлов с использованием asp.net mvc-5HttpPostedFileBase
но он показывает мне, что HttpPostedFileBase имеет значение null после выбора изображения
вот мой код
<input type="file" title="search image" file-model="profileimage" id="allfilepath" name="file" />
<button type="submit" class="btn btn-primary col-sm-5">
<span class="glyphicon glyphicon-plus"></span>
</button>
и мой контроллер
[HttpPost]
public ActionResult insert(HttpPostedFileBase file, quotationcompany quotecomp)
{
var allowedExtensions = new[] {
".Jpg", ".png", ".jpg", "jpeg"
};
if (file == null)
{
ViewBag.message = "Please Select Image";
return View();
}
else {
ViewBag.message = "Image Uploaded Successfully";
return View();
}
}
if (file == null) (в этой строке (file
) показывает мне нулевое значение после загрузки изображения в формате png)
что не так в этом коде?