Azure Blob Not Storing PDFs

2019-06-04 04:52发布

Ok so i have the following code-- it works perfectly for storing jpgs, but does not store pdfs. Any idea why?

 public bool TryStoreImage(string uri, string fileName)
    {
        try
        {
            WebClient wc = new WebClient();
            var blob = new BlobStorage().GetCloudBlobContainer();

            var store = blob.GetBlobReference(fileName);
            store.UploadByteArray(wc.DownloadData(uri));
            return true;
        }
        catch (Exception exc)
        {
            return false;
        }
    }

`

Again, every pdf i try to access gives me "pdf does not exist," even though i can see the pdf in the azure management screen. Every jpg i store however is perfectly accessible.

1条回答
地球回转人心会变
2楼-- · 2019-06-04 05:07

What do you mean by "pdf does not exist?" What tool is telling you that? How are you accessing the blob? Without knowing that, it's impossible to really figure it out, but I'd speculate that the lack of a content-type is a problem. Try store.Properties.ContentType = "application/pdf".

– smarx

查看更多
登录 后发表回答