public object UploadImage(HttpPostedFileBase File) { if (File == null || File.ContentLength == 0) { return("error:null"); } var name = "";//AzureBlobSA.UploadImage(AzureBlobSA.REFUND_FILES_CONTAINER, File); return(new { name, path = GetImagePath( AzureBlobSA.EncodeTo64(name), AzureBlobSA.GetSasUrl(AzureBlobSA.REFUND_FILES_CONTAINER) ) }); }
public ActionResult ImportImage(HttpPostedFileBase Image) { string path = @"D:\Temp\"; if (Image == null) { Error("Failed to upload image"); } else { var name = AzureBlobSA.UploadImage(AzureBlobSA.TEST_CONTAINER, Image.InputStream, Image.FileName, Image.ContentType); Success(String.Format("Got image {0} of type {1} and size {2} {3} {4}", Image.FileName, Image.ContentType, Image.ContentLength, name, HttpContext.Request.Url.Scheme + "://" + HttpContext.Request.Url.Authority + Url.Action("GetImage", new { id = AzureBlobSA.EncodeTo64(name), sas = AzureBlobSA.GetSasUrl(AzureBlobSA.TEST_CONTAINER) }))); } return(RedirectToAction("Index")); }