Ich bin Herumspielen mit Datei-Upload asp.net MVC-5 mit HttpPostedFileBase
aber es zeigt mir HttpPostedFileBase null ist, nachdem ich das Bild am Auswählen hierasp.net Mvc-5 HttpPostedFileBase ist null
mein Code
<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>
und mein Controller
[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 (Datei == null) (auf dieser Linie (
file
) sh schuld mich null, nachdem ich png Bild hochgeladen habe)
was ist falsch in diesem Code?
aussehen könnte Ein Rat! Bitte benutze [Search] (https://stackoverflow.com/search?q=HttpPostedFileBase+is+null), bevor du doppelte Fragen stellst, sonst kann deine Frage nach unten gehen (* Da hast du bereits 9 Fragen *) und dies könnte dich veranlassen [Question Ban] (https://stackoverflow.com/help/question-bans) – mmushtaq