More in this section

Forums / Developing with Sitefinity / Document Library - MimeTypes not stored properly for PPT files

Document Library - MimeTypes not stored properly for PPT files

6 posts, 0 answered
  1. Rama Krishna
    Rama Krishna avatar
    14 posts
    Registered:
    20 Nov 2008
    18 Mar 2010
    Link to this post

    Hi,
     
    We have uploaded 800+ different type of files (PDF, MS Word and PPT)  in Sitefinity Document library.   We couldn’t able to open some of the PPT files through the URL get  with ‘Link to this Item’.

    Example :   http://localhost:3050/ABC.WebSite/Libraries/Shared_AML/TestManagementPremium.sflb.ashx

    It’s blowing with following error.

    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    --------------------------------------------------------------------------------
    An invalid character was found in text content. Error processing resource 'http://localhost:3050/UnitedEducators.WebSite/Li...

    After lot of R&D,  I noticed that  the ‘MimeType’ of some of the PPT files was wrongly stored in the Sitefinity inbuilt database (sf_cmscontentbase table).   It’s stored as ‘application/octet-stream’ which is wrong.  It should be ‘application/vnd.ms-powerpoint’.   These PPT’s are in both 2003 & 2007 versions.

    Can you guide me to find out the root cause for this?    So that we will  take preventions for not to happen this in future.
     
    I am able to open some PPT files through Sitefinity URL without any issues.  

    Thanks,
            RK

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Mar 2010
    Link to this post
    Hello Rama Krishna,

    There must be some difference between the files that work and the ones that do no work. You could compare the PowerPoint version and the original extension of the PPT files to narrow down the problem and see why some files are accessible and why another are not. Check whether somehow the ppt has not been corrupted. In our code when an item is processed we get the MimeType from the extension

    Example

    Extension ".ppt"
    MimeType  "application/vnd.ms-powerpoint"

    As you can see the extension is essential for determining the Mime type. We use MimeMapper  class to get the mime type and set it inside the database. You could perform the following test at your end to see the actual type that is returned

    string file = "Test.ppt";
    string mime = MimeMapper.GetMimeMapping(file);

    Replace the Test.ppt with the name of your files.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Rama Krishna
    Rama Krishna avatar
    14 posts
    Registered:
    20 Nov 2008
    19 Mar 2010
    Link to this post

    Hi Dimitrov,

    Thanks for reply.

    How MimeMapper class maps the file extension with MimeType?   Is it pickup from OS or Sitefinity itself maintains the MimeType list?

    I guess, If it is pickup from OS then the client who is uploading PPT files into document library must have MS PowerPoint installed on his machine.  Am I correct?
     

    Regards,
             RK

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Mar 2010
    Link to this post
    Hi Rama Krishna,

    We have a Hashtable with predefined extensions and MIME Types. We get the extension from the file and call StringComparer.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. USDP
    USDP avatar
    2 posts
    Registered:
    12 Mar 2009
    08 Apr 2010
    Link to this post
    Since what version have you been using the Hashmap and string comparer method for determining mime-types?  I have a customer who is uploading PDF's and they are getting stored as application/octet-stream.  I believe my customer is running ver 3.6.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Apr 2010
    Link to this post
    Hello Kevin,

    The HashTable is used since 2008 - which is version 3.0. The octet-stream is used for .bin, .exe,.deploy and if the file is not recognized. You could try performing a test with the 2 rows code provided in one of the previous replies with several PDF file.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
6 posts, 0 answered