How to use s3Uploader.lastUploadedFileUrl method?


Hi friends:

I have an app that uploads a file to s3. I want to use s3Uploader.lastUploadedFileUrl to obtain the file URL and store it in my DB so that the file can then be downloaded by the user at a later date. Note that I am able to get the SignedUrl when I upload the file but that expires after 60 seconds so it won't work for my use case.

I see a couple of posts that mention the lastUploadedFileUrl method, but I don't see it in the documentation nor do I see a clear way to access and use it. Does it have to go into a Transformer on my s3-uploader component? Can I somehow grab it's value and set it as a temporary variable (this would be preferred)?

Any direction is greatly appreciated!

To download the file, you would still need the signed URL even if you store it in the db.... why not remove the timeout?

Thanks @ScottR I suppose that could work. But how, exactly, do I remove the timeout? :thinking: Although, it looks like the maximum timeout might be 7 days - which won't work. I need the user to be able to download the file at anytime after uploading it.

Maybe I'm going about this the wrong way...because I can't have the user go directly to an S3 URL since s/he won't have direct access to it - I'd need to have my S3 resource access the file and allow the user to save it to their desktop.

When the user clicks on the URL you should generate the signed URL for it...
For example - I save file paths for the files uploaded to s3 in the database, but when a user clicks on the file to view/download, I list all files available for view/download by way of the original file path I stored in the database, and when that happens; the Key comes along with it from s3. I will then call the generate a signed URL action type using the key stored in s3 for that file.