Specifying mime type for Documents & Files - General Discussions - General Discussions - Progress Community
 General Discussions

Specifying mime type for Documents & Files

  • Specifying mime type for Documents & Files
  • Hi,

    My site needs to support .M4V and .OGV videos using HTML5.  To do so, I'm adding the files to the "Documents & Files" section of Sitefinity 4.0.

    When browsing to the embed link to the file, it works; however, when placing this path in a <video> tag, the movie does not play.

    But, if I put the physical file in a subfolder of the site's root, it works.

    I think this is caused by the "Documents & Files" section of the CMS not allowing me to specify the MIME type.

    Is there a way to do this?
  • Update -

    I used Fiddler to monitor the HTTP traffic while downloading the .M4V file that was uploaded to the Documents & Files section of Sitefinity 4.0.

    Here is the HTTP header info:

    HTTP/1.1 200 OK
    Cache-Control: public
    Content-Length: 7794028
    Content-Type: application/octet-stream
    Last-Modified: Wed, 23 Mar 2011 15:30:02 GMT
    Server: Microsoft-IIS/7.5
    content-disposition: inline; filename=case_study_final.m4v

    As you can see, the Content-Type is set to "application/octet-stream".  I need to customize this based on file type, such as, "video/m4v".

    How would I go about doing that?
  • Telerik - Is there no suggested fix or workaround for this issue?

  • 259739_MediaContentMimeType.jpg
    Hi Chris Bryant,

     I logged a bug about this issue and we are going to review it on the next planing. I am sorry for inconvenience you are experiencing with this issue.

    For now you can workaround the problem by updating manually the MIME Type of a content item for corresponding extension in database.  For more details see attached file (MediaContentMimeType.jpg)


    All the best,

    Milena
    the Telerik team
  • I've made progress on this issue, but I still had to build a custom upload control completely outside of the CMS to resolve this.

    Adding the MIME type to IIS resolved the content-type issue; however, Sitefinity returns all documents & files with a status code of 200.  But, streaming files, such as M4V and OGG require a status code of 206: Partial Content.

    In the next update, if we could specify the MIME type and support streaming file types, that would be great!
  • Hello Chris,

    We added an option to specify MIME types for Files (Images, Videos, Document and Files) in section Settings.
    The feature will be available in our official release due next week.

    I hope this timing is OK with you.
    Thanks for taking the time to suggest this implementation!

    Greetings,
    Kalina
    the Telerik team

  • Was this ever released? I need to specify the mime type of my SVG files so that they can be displayed.

     Kurren

  • Hello Kurren,

    We have provided an answer in your support ticket. You can feel free to share your solution with our community.

    Regards,
    Kaloyan
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Why can't you post the answer here as well for others to see?
  • Hi Adam, you can change mime type with outboundRules

    For example outbound rules for .svg and .mp3 files.

     

    <outboundRules>
        <rule name="MP3" preCondition="MP3 PC" patternSyntax="Wildcard" stopProcessing="true">
          <match serverVariable="RESPONSE_Content-Type" pattern="*" />
          <action type="Rewrite" value="audio/mpeg" />
          <conditions></conditions>
        </rule>
        <rule name="SVG" preCondition="SVG PC" patternSyntax="Wildcard" stopProcessing="true">
          <match serverVariable="RESPONSE_Content-Type" pattern="*" />
          <action type="Rewrite" value="image/svg+xml" />
          <conditions></conditions>
        </rule>
        <preConditions>
          <preCondition name="MP3 PC">
            <add input="REQUEST_URI" pattern=".mp3$" />
          </preCondition>
          <preCondition name="SVG PC">
            <add input="REQUEST_URI" pattern=".svg$" />
          </preCondition>
        </preConditions>
    </outboundRules>

     

    Let me know if you have problems with that