Send File Via URL
Hey, I'm using Codeigniter as a framework for a web application. I just wanted to know how I should go about implementing a feature that allows users who have uploaded files to send them to others via a time-limited url. Any help would be appreciated, Thanks!
Not that hard conceptually. A database table with 3 columns:
When a user accesses something like: http://example.com/file-share.php?fileid
fileid - unique ID (like an MD5 hash of the filename)
expiry - datetime
path - path to the file
Then the script on that page grabs the record from the database where fileid is the uniqueID. It then checks the expiry date to make sure the link isn't already expired and then the script simply serves up the file (the path of which is stored in the path column in the database) via Content-Type: application/octet-stream.
This might help you out on how to serve the file:
Best of luck!
Last edited by aj_nsc; 05-01-2012 at 02:00 PM.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)