473,657 Members | 2,458 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.Po stedFile.Conten tType) of each document, "applicatio n/msword"
for MS Word and "applicatio n/vnd.ms-powerpoint" for MS PowerPoint.

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

Now, I could treat the uploaded document as ZIP-file and check on the
<Applicationele ment 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 9755
"Roel" <no_spam_please wrote in message
news:Od******** *****@TK2MSFTNG P06.phx.gbl...
When moving to the new Office2007 file-formats, DOCX and PPTX, the
contenttype is "applicatio n/x-zip-compressed" for both DOCX as PPTX.
Yes indeed...
Now, I could treat the uploaded document as ZIP-file and check on the
<Applicationele ment 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.GetExtensi on(FileUpload1. PostedFile.File Name).......
Feb 27 '07 #2

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

Similar topics

6
7327
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 as a byte array and manipulate it in my business object. Currently what I have is this, but my byte array in my business object is nothing. It's like it's not passed the file as a stream. I think I am not binding the FileUpload to the...
4
1959
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 files? Thanks, Sal
4
7974
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" Visible="False"> <asp:Button ID="Button2" runat="server" Text="Upload"
2
4353
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 not sure this can be doable in asp vbscript. any help or advice on this is much appreciable. thanks ibrahim
2
4122
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 open docx files.. I recieve an "HTTP Error 404 - File or directory not found. Internet Information Services (IIS)" error... thanks for your help.
2
8090
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 VarBinary(Max) field. I can saved files no problems but I can not view the docx file. I modified MIME type in IIS to ..docx application/vnd.openxmlformats-officedocument.wordprocessingml.document ..xlsx...
4
4243
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 this issue when i store and retrieve files of type .doc i am storing the file in a column of datatype image. Here is the code where i insert the file into database. Am sure the code is working. its just not working for .docx protected void...
2
3517
by: Manish | last post by:
Hi All : Could a friend suggest a way we can convert a pptx to xaml? Regards Manish
5
11030
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
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
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.