473,503 Members | 241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fileupload contenttype DOCX / PPTX

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
<Applicationelement 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
Feb 27 '07 #1
1 9732
"Roel" <no_spam_pleasewrote in message
news:Od*************@TK2MSFTNGP06.phx.gbl...
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
<Applicationelement 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) .......
Feb 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7313
by: Chris | last post by:
I want do my insert to a database using a formview bound to an objectdatasource. I also want to upload a file. I'm quite new to and this is just test code but Is there any way I can pass the file...
4
1953
by: ronc85 | last post by:
I'm using ASP.NET 2.0 and C#. With the FileUpload control is it possible to set Wildcards (e.g., *.xls and *.doc) so that when the user clicks the Browse button it defaults to Excel and/or Word...
4
7966
by: Mukesh | last post by:
i have coded like this <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server"> <asp:FileUpload ID="fupLogo" runat="server"...
2
4345
by: asp.net | last post by:
hello gents, i have a similar thing to do. i am not much into .net yet. i am currently working on asp website which generates doc file on a fly. i now want to convert these doc to docx files. i am...
2
4093
by: gwen.demby | last post by:
Hello, I hope all is well.. I was wondered if someone had a fix for opening docx file... I am currently using the response.redirect("path of word document") however it does not work while trying to...
2
8083
by: =?Utf-8?B?TWFkaXNvbg==?= | last post by:
Hi there, I'm working with VS 2008(framework3.5), IIS6, SQL Server 2005. I have website that allow users to upload doc, docx, xls, xlsx ... and so on. I save file to SQL Server 2005 with...
4
4234
by: =?Utf-8?B?U1VOTlk=?= | last post by:
Hi, i am uploading a .docx file into sql2005 and later when i retrieve the file from the database and i open it, i get a error message "The file is corrupted and cannot be open". I am not facing...
2
3510
by: Manish | last post by:
Hi All : Could a friend suggest a way we can convert a pptx to xaml? Regards Manish
5
10999
by: jettimadhu | last post by:
Hi , I want to convert the HTML/XML file to all other Ms-office file extentions like .ppt,.pptx,.docx.... Is there any API' s to get a possible solution for this problem?
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.