I have an image uri: https://api.tinify.com/output/im1c1s69phhvjjm6.jpg
This is a result image coming from an online image minification api.
And I wanted to download the minified image to a blob container in Azure.
I did:
var newBlockBlob = container.GetBlockBlobReference("minified-sample.jpg");
newBlockBlob.StartCopy(new Uri(fileUrl), null, null, null);
What happens then is that all I see is a 0 byte image file in the container.
I think there's an issue with the headers in the image you're trying to copy. I believe Content-Disposition header is set for this image. The reason I say this is because when I paste the URL in browser's address bar, instead of displaying the image in the browser I get prompted to download the image.
For copy operation to work, the Blob Service must be able to read the contents of the remote file in response stream when it requests the URL. Because the URL request results in downloading the file, Blob Service is not able to read the contents of the file and thus you get a 0 byte blob.
Edit: This is what I see in Google Postman
Related
I have a SAS uri from a blob containing Content-Encoding set to gzip and Content-Disposition set to rename the downloaded file. This works fine when accessing the link through the browser. What I want to achieve however is copy the file over to an Azure File share (StartCopyAsync) using the said blob SAS uri. This works, but the end result on the file share isn't decompressed like when downloaded through the browser.
Any ideas how this can be achieved?
Copy operation will not automatically decompress the content for you. It will simply copy the raw data and properties from source blob to destination file.
If you want to have the decompressed content in file storage, you will have to write the code to do that. You would need to write the code to download the blob, decompress its contents and then upload the decompressed content in file storage.
I am trying to download response from this url
http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I
The file it returns can be downloaded from browser, but when I try to save it with c# webclient I get only error message.
errorcode=180&status=fail&reason=HTTP+is+not+supported.
Is there any other way to download file from the API without using HTTP?
What have I tried (a is instance of WebClient):
byte[] policko = a.DownloadData("http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I");
a.DownloadFile("http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I", "filename");
a.DownloadString("http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I");
The response you got indicates that HTTP is not supported for this API call. The next natural choice is HTTPS.
https://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I
I am following https://docs.aws.amazon.com/mobile/sdkforunity/developerguide/s3.html (Upload an Object) to upload an Image.
I am unable to get the uploaded object link(Location) in response.
In my case I need to upload an Image and get the uploaded file URL after upload success.
How can I get uploaded object URL?
In some resource I searched they suggested to use s3Client.getResourceUrl("your-bucket", "some-path/some-key.jpg"); but I am unable to find that getResourceUrl method for Client in the example I am following.
I am using Azure blob storage in my project.And when I am trying to update an existing file, if the new file name is different from the current file name it will be updated and shown through the url. But the case is if the new file has a different name from the current file name, yes it will be updated but it will not be shown through the url. When I meant through the URL it means through the browser. And it is not being cached by the browser. I tried clearing browser cached and even used a different browser.
The URL is - https://cubictechdemo.blob.core.windows.net/media/Cache%202017_12062017111606.pdf
But still if I passed a query like https://cubictechdemo.blob.core.windows.net/media/Cache%202017_12062017111606.pdf?xxx
it will give me the updated file.
And however it would be downloaded through blockBlob.DownloadToStream() method. The url shows the old file and the downloadToStream gives me the updated file.
I don't know why this is happening. I am using UploadFromStream method. I can only get the new file if i passed some query.
CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
blockBlob.UploadFromStream(fileInput);
blockBlob.FetchAttributes();
Does anybody know why that is? Thank You.
I am saving an html document in the windows azure blob. Now i am trying to open that document by putting its URI in the address bar. But browser redirect me to orbit downloader to download that document. How can i open it by its blob uri? My document blob uri :
https://xxxxxx.blob.core.windows.net/user/name.html
You need to change the content type of that file to html. This is possible using tools like Azure Storage Explorer (see point 3D) or by using the SDK/REST API.