<pre> <div class="pb-2 shadow" style="background-color: gray; height: 150px; width: 150px ; position:relative; align-self:center" id="employee-pic-preview"> <img src="#" alt="Employee Pic" style="height:inherit;width:inherit" id="employeepic" /> </div> <div class="pb-2 justify-content-center align-content-center" style=" width: 100%" id="upload-button"> <div class="input-group mb-3 " style=" display:inline-flex !important;"> <div class="custom-file bg-white border rounded" style="height:inherit"> <label class="label text-black-50 text-left font-weight-bold text-center" for="inputGroupFile02">Browse Photo</label> <input type="file" class="custom-file-input" id="inputGroupFile02"> @*<label class="custom-file-label" for="inputGroupFile02" aria-describedby="inputGroupFileAddon02">Choose file</label>*@ </div> </div> </div>
<pre> [HttpPost] public JsonResult uploadFile(HttpPostedFileBase employeepic) { if (employeepic != null) { /* //rezie image before saving to network folder using var image = Image.Load(employeepic.OpenReadStream()); image.Mutate(x => x.Resize(150, 150)); image.Save(employeepic.FileName); */ string path = @"\\13.10.10.12\AQSImages\IdPictures\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } employeepic.SaveAs(path + Path.GetFileName(employeepic.FileName)); } return Json("Successfully added photo!"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)