someusernamehere schrieb:
Hey, I need to implement this with PHP, i.e. I have some files in
www.myserver.com/files what I need is when an user log into the
account a temporary URL is created for download a file in /files, and
then, when the file is downloaded the link disappear of course, I also
need to know how to protect the files for downloading by direct URL,
make sense?
No.
Send the file directly with the download-link by a reference or
something like that.
So nothing must bei stored temp.
Create a random numer and store it in a DB with the user id and req.
filename.
create the link like that:
download.php?id=user_id&ran=random_number
Example for download.php:
// select the req filename from db.
// exit, if not found
// else read the file into $dump
// and delete the entry in the DB
// example for CSV file
header("Content-Disposition: attachment; filename=export.csv");
header("Content-Type: text/csv");
echo $dump;