user142847 user142847 - 24 days ago 19
Perl Question

Content-Type setting for .MTS files

In my application i like to provide file download facility. How can I set the content types for .MTS files.

for example:

if ($fileName =~ /\.pdf$/i) { ## for pdf files
print "Content-Type: application/pdf", "\n";
print "Content-Disposition: Attachment; filename=$fileName", "\n\n";
print $File;
}elsif($fileName =~ /\.zip$/i){
print "Content-type: application/zip", "\n";
print "Content-Disposition: Attachment; filename=$fileName", "\n\n";
print $File;
}
elsif($fileName =~ /\.(mpg|mp3|mp4|swf|wmv|avi)$/i){
print "Content-type: application/mp3", "\n";
print "Content-Disposition: Attachment; filename=$fileName", "\n\n";
print $File;
}


MTS is a file extension for an AVCHD (Advanced Video Coding High Definition) video clip format for high-definition video.

Answer

You have to use correct MIME-TYPE for .MTS.

Below MIME types are supported:

application/metastream, video/avchd-stream, video/mts, video/vnd.dlna.mpeg-tts
Comments