in reply to Re: File Download
in thread File Download
I hope that's useful. It has a few extra steps that aren't reeeaalllly needed, but its nice to be on the safe side.sub DownloadFile { # $filepath is the directory # $filename is the name of the file my ($filepath,$filename) = @_; chdir($filepath) || return(0); my $filesize = -s $filename; # print full header print "Content-disposition: inline; filename=$filename\n"; print "Content-Length: $filesize\n"; print "Content-Type: application/octet-stream\n\n"; # open in binmode open(READ,$filename) || die; binmode READ; # stream it out binmode STDOUT; while (<READ>) { print; } close(READ); # should always return true return(1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: File Download
by Anonymous Monk on Apr 27, 2000 at 17:23 UTC | |
by BBQ (Curate) on Apr 28, 2000 at 08:24 UTC | |
by BBQ (Curate) on Apr 28, 2000 at 08:31 UTC | |
|
Re: RE: Re: File Download
by wellsayd (Initiate) on Jul 26, 2002 at 16:45 UTC |