示例#1
0
 public JsonResult UploadLogo(Bank modal)
 {
     try
     {
         if (modal != null && modal.LogoFile != null && modal.LogoFile.Length > 0)
         {
             var filename = Path.Combine(RandomString() + modal.LogoFile.FileName);
             var path     = Path.Combine(_HostingEnvironment.WebRootPath, "Uploaded_Image", filename);
             using (var fileStream = new FileStream(path, FileMode.Create))
             {
                 modal.LogoFile.CopyTo(fileStream);
             }
             string filePath = Path.Combine(_HostingEnvironment.WebRootPath, "Uploaded_Image", filename);
             //modal.LogoFileData = ReadFile(filePath, modal.LogoFile.FileName);
             resp.Data   = filename;
             resp.Status = Constants.ResponseStatus.Success;
         }
         else if (modal.Logo != null && modal.Id != 0)
         {
             resp = _interface.CheckImage(modal);
         }
         else
         {
             resp.Message = Constants.ControllerMessage.Upload_Needed;
         }
     }
     catch
     {
         resp.Message = Constants.ControllerMessage.Upload_Failed;
     }
     return(Json(resp));
 }