[RegularExpression(@"([a-zA-Z0-9\s_\\.\-:])+(.png|.jpg|.gif)$", ErrorMessage = "Only Image files allowed.")] public HttpPostedFileBase Logo { get; set; }
@Html.ValidationSummary(true) @using SocialMediaAnalytics.Web.Models; @model SocialMediaAnalytics.Web.Models.Account.RegistrationModel @using (Html.BeginForm("CreateDatabase", "Settings", FormMethod.Post, new { id = "formAddDatabaseandWorkSpace", encType = "multipart/form-data" })) { <div class="col-sm-12"> <div class="form-group"> <label>Logo</label> @Html.TextBoxFor(m => m.Logo, new { type = "file" }) </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary" id="btnAddDB">Save</button> </div> }
[HttpPost] public JsonResult CreateDatabase(RegistrationModel model) { try { else if(model.Logo!=null) { LogoUpload(model); return Json(new { title = "Upload Logo", message = "Logo uploaded successfully", type = "Success" }); } } </pre but the value for "Logo" in model is always null even after browsing the image. What I have tried: I have tried with type instead of @Html.TextBoxFor() but its getting null everytime.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)