Quantcast
Channel: Azure Management Portal forum
Viewing all articles
Browse latest Browse all 4189

Upload Scribd with Azure

$
0
0

Hi all

I have uploaded my website into Windows Azure and was running fine until i met with a problem.

I have been trying to upload a file from my computer into scribd but met an error. It was working fine on localhost though.

Error Message : File can not be uploaded because: Could not find a part of the path 'E:\sitesroot\0\......docx'.

Code References :

string uploadPath = Server.MapPath("" + "//Documents//" + FileUploadControl.FileName);

 Scribd.Net.Document _document = Scribd.Net.Document.Upload(new System.IO.FileStream(uploadPath, System.IO.FileMode.Open), AccessTypes.Public, false);

Windows Azure additional coding:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
                        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
                        CloudBlobContainer container = blobClient.GetContainerReference("crep");
                        container.CreateIfNotExists();
                        container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob });

CloudBlockBlob blockBlob = container.GetBlockBlobReference(uploadPath);
                                using (var fileStream = System.IO.File.OpenRead(@"" + uploadPath))
                                {
                                    blockBlob.UploadFromStream(fileStream);
                                }


Viewing all articles
Browse latest Browse all 4189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>