Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How make download link for document in liferay 7.2
Hello,
I am using Liferay 7.2 for one of my projects.
We are working emails section of our project in which we need to send an email with one download link.
When the user clicks on the link, one zip file will be download. (File will be on /temp folder od in document&media library)
The download link will be valid for 1 day and then we need to show the expiration message on the screen.
How can we achieve this? please suggest.
We have tried the following way.
struts in Liferay: but it only working with URL starts with "/c/....". if we make a URL like this, it asks for login first (We need to download without login).
We checked to set an expiration time on a document in the document&media section and give the download link from there, but we can not set the expiration time in the document and media.
Can you please suggest best possible way to achieve this? thank you in advance
Hi,
As every document is an asset , you can try setting expiration date in asset entry for respected document. Then you can have a service wrapper for DLAppService and check the document expiration date from asset entry service.
If you are doing MVC Java portlets you can:
- Generate a uuid for each email you send, merge it with the serveResource URL of a portlet, include that in the email
- Store the uuid on a serviceBuilder table with the expiry date
- When a user clicks on the link, your portlet serveResource will get the uuid, check if it's valid, get the file and send it to the browser
HTH
Fernando
Powered by Liferay™