public static string UploadLessonResourceImage(string data) { var storageName = Guid.NewGuid().ToString().Replace("{", "").Replace("}", ""); // convert string to stream byte[] byteArray = Encoding.UTF8.GetBytes(data); //byte[] byteArray = Encoding.ASCII.GetBytes(contents); MemoryStream stream = new MemoryStream(byteArray); AzureBlobStorage.Upload(stream, Constants.Azure.AZURE_UPLOADED_LESSON_RESOURCES_STORAGE_CONTAINER, storageName); return(storageName); }
private static string Upload(HttpPostedFileBase file, string container) { if (file == null) { return(null); } if (file.ContentLength > 2500000) { throw new Exception("Files can't exceed 2.5MB in size."); } var storageName = Guid.NewGuid().ToString().Replace("{", "").Replace("}", ""); AzureBlobStorage.Upload(file.InputStream, container, storageName); return(storageName); }
public static void DownloadProfilePicture(MemoryStream ms, string storageName) { AzureBlobStorage.Download(bat.logic.Constants.Azure.AZURE_UPLOADED_PROFILE_IMAGES_STORAGE_CONTAINER, storageName).DownloadToStream(ms); }
public static void DownloadExamPaper(MemoryStream ms, string storageName) { AzureBlobStorage.Download(bat.logic.Constants.Azure.AZURE_UPLOADED_EXAM_PAPERS_STORAGE_CONTAINER, storageName).DownloadToStream(ms); }
public static void DownloadLessonResource(MemoryStream ms, string storageName) { AzureBlobStorage.Download(bat.logic.Constants.Azure.AZURE_UPLOADED_LESSON_RESOURCES_STORAGE_CONTAINER, storageName).DownloadToStream(ms); }