Unsolved
This post is more than 5 years old
18 Posts
0
3281
How to get the URL of uploaded file
Hi
I need to get the url of uploaded file by using .NET. Just click that url to download the file from the cloud server.
Please let me know the solution.
Regards,
Karthik.
JasonCwik
281 Posts
0
August 23rd, 2011 03:00
Karthik,
You want "GetShareableUrl" from EsuApi. You provide the Identifier (either an ObjectId or ObjectPath) and an expiration date for the URL, e.g.
DateTime expiration = DateTime.UtcNow;
expiration += TimeSpan.FromHours(5);
Uri u = esu.GetShareableUrl(id, expiration);
kartike
18 Posts
0
September 5th, 2011 04:00
Hi
I can download the files from url get by getSharableUrl method.
But the url not contains the exact path where i moved the files.
For example,
i moved the file into the following locaition into cloud,
string filePath= "C://Users//karthike//Desktop//Element.docx";
ObjectPath objectpath = new ObjectPath("Support/" + productName + "/" + incidentId + "/" + fileName);
objectId = upload.CreateObjectOnPath(objectpath, filePath, null, null);
url = cloudRest.getShareableUrl(objectId, DateTime.MaxValue);
i need the url to download it looks,
http://................................................/Support/ productName/incidentId/fileName.
How can i get the url like above format?
Please Can you give me a solution?
Regards,
Karthik.
rbala1
222 Posts
0
September 5th, 2011 11:00
Karthik,
Instead of passing in the ObjectId to getShareableUrl pass in the ObjectPath. That will return a pre-signed URL to the object in the namespace (the path to the object).
Raj
kartike
18 Posts
0
September 6th, 2011 03:00
Hi,
I can get the url using objectpath.
URL contains userid,expired date value and signature.why signature has different value for each files?
url is like this:
"https://cloudonestorage.peer1.com/rest/namespace/Support/DirectTrac/66666/Element.docx
?uid=value&expires=253402300800&signature=value"
i need to use the url like this,
"https://cloudonestorage.peer1.com/rest/namespace/Support/DirectTrac/66666/Element.docx"
when i click this url i have to redirect to the original link.
how can i redirect to original url?
Regards,
Karthik.
rbala1
222 Posts
0
September 6th, 2011 04:00
Karthik,
The signature changes with each request for the same file when the timestamp changes between requests. The timestamp is used in calculation of the hash.
You won't be able to get the URL in the precise format that you need. Our shareable URL must contain the UID, signature, and expiration. Those attributes are required for Atmos to validate the authenticity of the request.
Raj
kartike
18 Posts
0
September 6th, 2011 05:00
Hi bala,
When i click the below url,
https://cloudonestorage.peer1.com/rest/namespace/Support/DirectTrac/66666/Element.docx
It should redirect to following url,
https://cloudonestorage.peer1.com/rest/namespace/Support/DirectTrac/66666/Element.docx
?uid=value&expires=253402300800&signature=value
Is this possible? If yes,Can you please give me a solution?
Regards,
Karthik
kartike
18 Posts
0
September 6th, 2011 05:00
Hi,
Please can anyone answer to my previous question?
Regards,
Karthik.
rbala1
222 Posts
0
September 6th, 2011 06:00
Just to clarify:
The signature will only change when the expiration changes between requests.
So in this example:
If the expiration does not change the signature will not change.
Raj
JasonCwik
281 Posts
1
September 6th, 2011 06:00
Hi Karthik,
For security reasons, every URL request must be signed. The "Shareable URL" feature embeds the signature information as URL parameters. There currently is no way to authorize direct access to an object without a valid signature. You will have to generate a shareable URL that expries many years into the future and distribute that link if you want public access to an object.