Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public static void DownloadProfilePicture(MemoryStream ms, string storageName)
 {
     AzureBlobStorage.Download(bat.logic.Constants.Azure.AZURE_UPLOADED_PROFILE_IMAGES_STORAGE_CONTAINER, storageName).DownloadToStream(ms);
 }
Ejemplo n.º 4
0
 public static void DownloadExamPaper(MemoryStream ms, string storageName)
 {
     AzureBlobStorage.Download(bat.logic.Constants.Azure.AZURE_UPLOADED_EXAM_PAPERS_STORAGE_CONTAINER, storageName).DownloadToStream(ms);
 }
Ejemplo n.º 5
0
 public static void DownloadLessonResource(MemoryStream ms, string storageName)
 {
     AzureBlobStorage.Download(bat.logic.Constants.Azure.AZURE_UPLOADED_LESSON_RESOURCES_STORAGE_CONTAINER, storageName).DownloadToStream(ms);
 }