Esempio n. 1
0
        public void PutBlob(string filename, string blobName)
        {
            CloudBlob blob = cloudBlobClient.GetBlobReference(blobName);

            blob.Properties.ContentType = MimeTypeHelper.GetMimeType(filename);

            blob.UploadFile(filename);
            Trace.TraceInformation("Done");
        }
Esempio n. 2
0
        public void PutLargeBlob(string filename, string blobName)
        {
            cloudBlobClient.WriteBlockSizeInBytes = Settings.WriteBlockSizeInBytes();

            Trace.TraceInformation("UploadingBlob..");

            CloudBlockBlob blob = cloudBlobClient.GetBlockBlobReference(blobName);

            blob.Properties.ContentType = MimeTypeHelper.GetMimeType(filename);

            blob.ParallelUpload(filename, null);

            Trace.TraceInformation("Done");
        }
Esempio n. 3
0
        public void PutBlob(string filename, string containerName, string blobName)
        {
            CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName);

            container.CreateIfNotExist();

            Trace.TraceInformation("UploadingBlob..");

            CloudBlob blob = container.GetBlobReference(blobName);

            blob.Properties.ContentType = MimeTypeHelper.GetMimeType(filename);

            blob.UploadFile(filename);
            Trace.TraceInformation("Done");
        }
        public void PutLargeBlob(string filename, string containerName, string blobName)
        {
            CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName);

            container.CreateIfNotExists();

            cloudBlobClient.SingleBlobUploadThresholdInBytes = Settings.WriteBlockSizeInBytes();

            Trace.TraceInformation("UploadingBlob..");

            CloudBlockBlob blob = container.GetBlockBlobReference(blobName);

            blob.Properties.ContentType = MimeTypeHelper.GetMimeType(filename);


            blob.ParallelUpload(filename, null);

            Trace.TraceInformation("Done");
        }
        public void PutBlob(string filename, string containerName, string blobName)
        {
            if (!File.Exists(filename))
            {
                throw new ArgumentException("The file to upload must be an existing file", "filename");
            }

            CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName);

            container.CreateIfNotExists();

            Trace.TraceInformation("UploadingBlob..");

            CloudBlockBlob blob = container.GetBlockBlobReference(blobName);

            blob.Properties.ContentType = MimeTypeHelper.GetMimeType(filename);
            using (var fs = File.OpenRead(filename))
            {
                blob.UploadFromStream(fs);
            }
            Trace.TraceInformation("Done");
        }