How to offer large audio files for download after payment

I want to offer audio files for upload on my site after a user completes a PayPal transaction. The commercial side is already written and working - the site is built on PHP with the Zend Framework.

So I don’t incur large expenses for storage and bandwidth, I would like to place files on the Amazon S3 service. However, I am not sure if this is suitable for my requirements. As soon as the PayPal transaction is completed, I would like to assign the user a unique identification key of some type, send them to the place where they enter the key, and the file they bought is offered for download. Then the key will expire.

I have no problem writing code to create, save, and delete a key. My question is this: how can I protect / hide a file stored on Amazon S3 and then offer it to be downloaded to an authorized user with a URL that will subsequently become invalid, while at the same time transferring the file directly from Amazon, and not through my server?

Is this possible, or do I need another solution?

+4
source share
2 answers

Amazon S3 has a Pre-Signed URL feature that allows you to create a URL to access time-restricted content from other content. See Alternative documentation for the query string check query .

+3
source

Admittedly, I know very little about Amazon S3, but if you saved the file in a database in S3 and wrote a page that will serve the file from the database with the correct key. Then you would need to publish the web service on S3, which you could call on your website to authorize this key, and after that just redirect the user to the page serving the file.

-1
source

Source: https://habr.com/ru/post/1304263/


All Articles