Hi everyone,
I have recently started deep dive into Phoenix LiveView, I have not found a LiveView approach to download a document from a LiveView template
Goal: - I have a list that shows the name of the documents, on clicking any name I want to fetch the stored location( path of the S3 )from the database and prepare a presigned URL with an expiration on it which can be used to download.
The approach I have figured is to on-click of the document name, redirect to a Phoenix route then return something like
conn
|> put_resp_header("content-disposition",
~s(attachment; filename="#{filename}"))
|> send_file(200, filename)
Is there any LiveView approach to implement it ??
Any reference to the document or example link will be helpful.
Thanks in advance.