Exemple #1
0
        public async Task <CloudBlockBlob> UploadDocument(HttpPostedFileBase documentFile)
        {
            string blobName = documentFile.FileName;// Guid.NewGuid().ToString() + Path.GetExtension(profileFile.FileName);

            // GET a blob reference.
            if (!string.IsNullOrEmpty(blobName))
            {
                CloudBlockBlob documentBlob = DocumentContainer.GetBlockBlobReference(blobName);
                // Uploading a local file and Create the blob.
                using (var fs = documentFile.InputStream)
                {
                    await documentBlob.UploadFromStreamAsync(fs);
                }
                return(documentBlob);
            }
            return(null);
        }