www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > Other

    Other Discussion and technical support for any other scripting methods.

     
     
    Thread Tools Rate Thread Display Modes
    Prev Previous Post   Next Post Next
      #1  
    Old 10-05-2007, 11:33 AM
    discorax's Avatar
    discorax discorax is offline
    Ryan C Davidson - web dev
     
    Join Date: Apr 2007
    Location: Seattle, WA
    Posts: 53
    Thumbs up Is your docx file turning into a zip? - SOLUTION

    In an attempt to save someone some heartache, I'm going to write up about a problem that I've seen, but hasn't been well documented. The new Office 2007 file extensions (docx,potx,xlsx,etc) turning into ZIP files when they are uploaded to a web server and then downloaded.

    The new Office 2007 file formats are now using an Open XML file format system so they are more compatible with other office programs from Google, Open Office...etc. Essentially they are ZIP files that are full of XML files that when opened with the a proper application turn into a friendly word document. While that's pretty nice of Microsoft, they haven't been to good about release MIME type information for these file formats which can cause some interesting issues when trying to upload and download them to a webserver.

    I stumbled onto this problem while I was working with MediaWiki. I was uploading Office 2007 files (docx to be precise) and when my co-workers went to download them on Vista, they would save as .zip files. When they tried to open them up they were just a bunch of XML files which to the untrained eye would be a bunch of gobbledygook.

    I was tasked with solving this problem. After searching the internet for a good 2 hours I stumbled onto a post on a DRUPAL blog. Someone was asking about this problem using Drupal. So I thought, what do Drupal and MediaWiki have in common...php/mysql backend was what I came up with.

    So after doing some more research I found a blog post written by Dave Overton. He was trying to solve that same problem for a local SBS server. He found a solution that involved the MIME Types on the server. The lightbulb went off.

    Since Office 2007 is new and Vista is new a web server isn't going to know what application runs what file extension. At some point Microsoft will release an update (I hope) but until them we can just add in the appropriate MIME Types to our web servers and that should give us the results we want.

    I put up the list of office 2007 file extensions and their MIME Types on to the server hosting my MediaWiki and just like that everything worked. Here is the list of Office 2007 MIME type associations you can add if you run into this same problem.

    Code:
    ".manifest", "application/manifest"
    ".xaml", "application/xaml+xml", 
    ".application",  "application/x-ms-application", 
    ".deploy", "application/octet-stream"
    ".xbap", "application/x-ms-xbap"
    
    ".docm","application/vnd.ms-word.document.macroEnabled.12" 
    ".docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document" 
    ".dotm","application/vnd.ms-word.template.macroEnabled.12" 
    ".dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template" 
    ".potm","application/vnd.ms-powerpoint.template.macroEnabled.12" 
    ".potx","application/vnd.openxmlformats-officedocument.presentationml.template" 
    ".ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12" 
    ".ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12" 
    ".ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow" 
    ".pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12" 
    ".pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation" 
    ".xlam","application/vnd.ms-excel.addin.macroEnabled.12" 
    ".xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12" 
    ".xlsm","application/vnd.ms-excel.sheet.macroEnabled.12" 
    ".xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" 
    ".xltm","application/vnd.ms-excel.template.macroEnabled.12" 
    ".xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"
    __________________
    discorax - www.ryancdavidson.com
    PBJS - www.pbjs.com
    Reply With Quote
     

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:23 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.