Horas and konnichiwa untuk semua


Temporary link in PHP
March 17, 2004, 5:37 pm
Filed under: notes/Programming

Create a download handler:

/files/download.php

This file streams a document given certain parameters.

/files/download.php?id=e45fg6f7a7c7b776d4cc4e56&fileid=4001

The id could be an MD5 of the SessionID for that user
and the download handler just checks the session ID with the one passed in

The 4001 could be a db lookup giving information about the file.
(path to file, MIME type, etc)

Then, just stream the file back to the user with the appropriate Headers

Content-type: application/zip
Content-disposition: attachment; filename=file4001.zip

Advertisement

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s



Follow

Get every new post delivered to your Inbox.