SHARE
TWEET

Untitled

a guest Aug 19th, 2019 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Task CopyFile(string fileName, string targetPath)
  2. {
  3.     var blobRef = Container.GetBlockBlobReference(targetPath);
  4.  
  5.     blobRef.Properties.ContentType = GetContentType(fileName);
  6.  
  7.     return blobRef.UploadFromFileAsync(fileName);
  8. }
  9.  
  10. public string GetContentType(string fileName)
  11. {
  12.     var provider = new FileExtensionContentTypeProvider();
  13.  
  14.     if (!provider.TryGetContentType(fileName, out var contentType))
  15.     {
  16.         contentType = "application/octet-stream";
  17.     }
  18.  
  19.     return contentType;
  20. }
  21.      
  22. <Error>
  23.     <Code>ResourceNotFound</Code>
  24.     <Message>
  25.         The specified resource does not exist. RequestId:12485818-601e-0017-6f69-56c3df000000 Time:2019-08-19T08:35:13.2123849Z
  26.     </Message>
  27. </Error>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top