예제 #1
0
        public static bool UploadFile(String name, String description, String longComment, byte[] data)
        {
            var id             = Guid.NewGuid();
            var time           = DateTime.UtcNow;
            var uniqueBlobName = String.Format("files/{0}", id);

            db.AddToFiles(File.CreateFile(id, name, time, description, longComment));
            db.SaveChanges();

            CloudBlockBlob blob = container.GetBlockBlobReference(uniqueBlobName);

            blob.UploadByteArray(data);
            return(true);
        }