Fileupload contenttype DOCX / PPTX

Discussion in 'ASP .Net' started by Roel, Feb 27, 2007.

  1. Roel

    Roel Guest

    Hi all,

    I'm using the FileUpload control for uploading MS Word and MS PowerPoint
    documents.

    To check if a user uploads a correct document, I check the contenttype
    (FileUpload1.PostedFile.ContentType) of each document, "application/msword"
    for MS Word and "application/vnd.ms-powerpoint" for MS PowerPoint.

    When moving to the new Office2007 file-formats, DOCX and PPTX, the
    contenttype is "application/x-zip-compressed" for both DOCX as PPTX.

    Now, I could treat the uploaded document as ZIP-file and check on the
    <Application> element in the "app.xml" in the subdir "docProps" in the ZIP
    but isn't there an easier way to accomplish the correct MIME content type?

    Regards,
    Roel
    Roel, Feb 27, 2007
    #1
    1. Advertising

  2. Roel

    Mark Rae Guest

    "Roel" <no_spam_please> wrote in message
    news:Od$...

    > When moving to the new Office2007 file-formats, DOCX and PPTX, the
    > contenttype is "application/x-zip-compressed" for both DOCX as PPTX.


    Yes indeed...

    > Now, I could treat the uploaded document as ZIP-file and check on the
    > <Application> element in the "app.xml" in the subdir "docProps" in the ZIP
    > but isn't there an easier way to accomplish the correct MIME content type?


    I'm not sure - I have already come across this exact problem, and I've
    worked around it by checking the file extension... Not ideal, and not
    particularly robust but, until the mimetypes are updated for Office 2007, I
    don't think there's another way...

    Path.GetExtension(FileUpload1.PostedFile.FileName).......
    Mark Rae, Feb 27, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    460
    Arne Vajhøj
    Feb 13, 2008
  2. David Thielen
    Replies:
    3
    Views:
    78,942
    David Thielen
    May 27, 2008
Loading...

Share This Page