Azure Blob Not Storing PDFs

时光怂恿深爱的人放手 提交于 2019-12-08 09:25:45

问题


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:


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



来源:https://stackoverflow.com/questions/12719818/azure-blob-not-storing-pdfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!