Jump to content

temporary download link


optikalefx

Recommended Posts

HI all,

 

I have a file placed outside my web directory.  I create via php a sym link to that file so a user can download that file.  After the download, or after a period of time, i need the sym link to be removed and i need to add some info to my database that the download is done.

 

any ideas?

Link to comment
Share on other sites

Instead of symlinking the file, you might want to create a download script that takes in an id and looks up the filename in a database.  Then you can send the correct headers and call readfile() to force the download.

 

This way, you can flag the download in the database so you know it has been downloaded.

 

You can also use a cron job to clean up downloads that have been sitting around for too long.

Link to comment
Share on other sites

Is there any way to tell that the download is completed?

 

Don't believe so - at least not directly. There might be a way to check through the server logs/data to see if it "sent" all the packets for the file. But that is still no guarantee that they all made it to the client.

Link to comment
Share on other sites

How can you put a time limit on it?  I thought of cookies but thats not always good, and sweeping the server folder but that requires constant checks.  The issue is that on this last download page, no more PHP is run, unless i do something via ajax when they click the download link.  But i cant kill the sym link when they click the link of course.  The download script idea was alright, except it doesnt work for this because this download link is an XPI for a firefox extension and if the link is not to a .xpi then the javascript wont verify it even if i redirect the headers and all.  So im thinking itll have to be attached to the download? or if there exists a self destructing timer?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.