Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sunrise's avatar

How to know a file is downloaded successfully?

I am using Laravel 5.2.
I would want to record file's downloading,there are 3 tables: users , files , download_records ,

users

id       name       password          email
1         Jim        ******           Jim@example.com
2         Charles    ******           Charles@example.com

files

id         file_path                  
1           /var/www/uploads/001.jpg
2           /var/www/uploads/002.doc

download_records

id         file_id         user_id      download_time
1            2                1          2016-04-15 09:00:00
2            1                2          2016-04-15 09:10:00

when a file is downloaded by someone, a record will be added into download_records,the question is:
How to know a file is downloaded successfully?
How to write the controller?

0 likes
1 reply
ohffs's avatar

You might be able to use something like Downloads.jsm but (at a guess) you'd need to re-implement it per-browser (though I'm not sure).

Please or to participate in this conversation.