Rich Fernandez wrote:
: Thanks for your responses but
: I guess I wasn't clear enough with my original question. Sorry.
: Let me try again...
oops, sorry about that... didn't read your code fully.
: I _already_ have a link on my page that says
: <a href=http://gromit/cgi-bin/juggling.pl?video=rr.mpg>
: Rubinstein's Revenge</a>"
: ...
: So...when the script is envoked, it already knows the name of the file to
: display. How do I get the script to send that file to the browser?
You want to open the file and dump its contents to STDOUT. There are lots
of wasy to do this. Here's how I would do it:
print STDOUT $query->header(
-type => "video/mpeg",
);
open MOVIE, $vidfile or die "Couldn't open $vidfile: $!";
while ( read(VIDFILE, $_, 100_000) ) { print STDOUT; }
close MOVIE;
(You could replace "die" with something friendlier.) This reads the
file in 100kb chunks and prints each chunk to STDOUT. Note that
header() has to send the right MIME type (I think this is the right one
for an mpg).
-- tdk