Skip to main content
Inspiring
December 29, 2011
Question

CFFILE - Accepting Office 2007 Mime Types

  • December 29, 2011
  • 1 reply
  • 3494 views

How can all mime types for Office 2007 be included in accepting file types. This is what I have:   

...accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, etc.".

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
December 29, 2011

jenn wrote:

How can all mime types for Office 2007 be included in accepting file types. This is what I have:   

...accept="application/vnd.openxmlformats-officedocument.spreadsheetml .sheet, etc.".

I would do it as follows, the way El Dombo would. Get hold of all the Office 2007 MIME types. Then shove them all in the accept attribute.

<cfset OFFICE2007MimeTypes = "application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-word.document.macroEnabled.12,application/vnd.openxmlformats-officedocument.wordprocessingml.template,application/vnd.ms-word.template.macroEnabled.12,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel.sheet.macroEnabled.12,application/vnd.openxmlformats-officedocument.spreadsheetml.template,application/vnd.ms-excel.template.macroEnabled.12,application/vnd.ms-excel.sheet.binary.macroEnabled.12,application/vnd.ms-excel.addin.macroEnabled.12,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint.presentation.macroEnabled.12,application/vnd.openxmlformats-officedocument.presentationml.slideshow,application/vnd.ms-powerpoint.slideshow.macroEnabled.12,application/vnd.openxmlformats-officedocument.presentationml.template,application/vnd.ms-powerpoint.template.macroEnabled.12,application/vnd.ms-powerpoint.addin.macroEnabled.12,application/vnd.openxmlformats-officedocument.presentationml.slide,application/vnd.ms-powerpoint.slide.macroEnabled.12,application/onenote,application/vnd.ms-officetheme">

<cfif isdefined("form.sbmt")>
<cffile action = "upload" 
        fileField = "myFile" 
        destination = "c:\test" 
        accept = "#OFFICE2007MimeTypes#" 
        nameConflict = "MakeUnique">
</cfif>
<cfform method="post" enctype="multipart/form-data">
<cfinput name="myFile" type="file">
<cfinput name="sbmt" type="submit" value="upload">
</cfform>

jenn1Author
Inspiring
December 30, 2011

It takes all formats except for the spreadsheets. Any ideas?

BKBK
Community Expert
Community Expert
December 30, 2011

What's the file extension of the spreadsheets?