www.webdeveloper.com
Results 1 to 2 of 2

Thread: Send File Via URL

  1. #1
    Join Date
    Apr 2012
    Posts
    5

    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!

  2. #2
    Join Date
    Dec 2005
    Posts
    2,984
    Not that hard conceptually. A database table with 3 columns:

    Code:
    fileid    - unique ID (like an MD5 hash of the filename)
    expiry  - datetime
    path    - path to the file
    When a user accesses something like: http://example.com/file-share.php?fileid

    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:
    http://www.phpclasses.org/package/22...e-support.html

    Best of luck!
    Last edited by aj_nsc; 05-01-2012 at 03:00 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles