[thelist] Downloading a file without giving the link

Means, Eric D eric.d.means at boeing.com
Wed Oct 2 15:01:01 CDT 2002

-----Original Message-----
From: Kevin [mailto:lists at irubin.com]
Sent: Wednesday, October 02, 2002 1:45 PM
To: Thelist
Subject: [thelist] Downloading a file without giving the link

> I am in the process of developing a perl script that will allow
> a zip file only once. My problem is that if I give out the link, I will
> have any control and people will be able to download the file many times.
> What is the best way to handle a situation like this? Can the binary data
> send via a special header?

Assume FILE is the file pointer to the file you want to send.
$fileName is the name of the file (for instance, mydoc.doc)
$filesize is the size, in bytes, of the file.

The first three lines are the headers you need to send, followed by an extra
linefeed (print "\n";), then the file data.

  print "Content-Type: application/octet-stream\n";
  print "Content-Disposition: attachment; filename=\"" . $fileName . "\"\n";

  print "Content-Length: $filesize\n";
  print "\n";
    print $_;

More information about the thelist mailing list