Amazon S3 upload file and get URL in Unity3d - c#

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.

Related

Upload Image to s3bucket using front end as vuejs and backend as c# ASP.NET

I am passing
Logo = event.target.files[0]
this value of input file from my vuejs to backened.
On my backend C# ASP.NET
i am trying to get the value by
IFormCollection Logo
I don't know whether it is write method to send/recieve the file or I am sending right data or not.
The problem is I really dont know how to recieve the file in C# and send it to s3 bucket.
You haven't shared much code with your attempt so I will give you a generic answer to work through.
You can upload your files to ASP.NET Core by following this guide Upload files in ASP.NET Core.
If you do this, you will use the IFormFile interface, which has the OpenReadStream() method.
You can then use the TransferUtility Upload method in the AWS SDK for .NET by passing the stream that you got from OpenReadStream().

Downloading youtube video info

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

Copy or Download an image file from URI to Azure Blob

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

C# after uploading image, get url of uploaded image in google cloud storage

I created an image uploader using c# mvc5. I managed to upload the images to google cloud storage. Now I want to get the url of the uploaded file to return to the user for reference. I've been looking around the docs in google and can't find it. Anyone can provide me some links or codes will be helpful. Thanks.
See the documentation page on Request URIs.
In general, if you upload to a bucket named foo and an object named bar/baz, the URL for your object will be:
https://storage.googleapis.com/foo/bar/baz
With the GCS C# .NET library, you can use one of the Storage.v1.Data.Object class properties:
MediaLink to get the download link, or
SelfLink to get the canonical URL for the object.

How to open html document in the browser by its Uri

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.

Categories

Resources