user142847
user142847

Reputation: 15

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.

Upvotes: 1

Views: 2633

Answers (2)

Chankey Pathak
Chankey Pathak

Reputation: 21676

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

Upvotes: 0

Mladen B.
Mladen B.

Reputation: 3005

The proper mime-type for the MPEG-2 Transport Stream (.mts) should be video/MP2T, according to this RFC.

Upvotes: 4

Related Questions