agent00013 has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for your help.#!/usr/bin/perl use strict; use File::Basename; use File::MMagic; #skip some code here... my ($name,$path,$suffix) = fileparse($filename); my $mm = File::MMagic->new('/usr/share/file/magic'); my $mimetype = $mm->checktype_byfilename($name); print "Content-type: $mimetype\n"; print "Content-Disposition: attachment; filename=\"$name\"\n\n"; #other code goes here to output file...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File::Basename and File::MMagic for File Downloads from Website
by ikegami (Patriarch) on Nov 21, 2008 at 00:23 UTC | |
by agent00013 (Pilgrim) on Nov 21, 2008 at 00:53 UTC | |
by ikegami (Patriarch) on Nov 21, 2008 at 02:05 UTC | |
by MidLifeXis (Monsignor) on Nov 21, 2008 at 14:44 UTC | |
by ikegami (Patriarch) on Nov 21, 2008 at 19:45 UTC | |
Re: File::Basename and File::MMagic for File Downloads from Website
by fmerges (Chaplain) on Nov 21, 2008 at 04:16 UTC |