?
Solved

What is the Mime type for a CFM file? Uploading .cfm files

Posted on 2003-03-06
8
Medium Priority
?
1,893 Views
Last Modified: 2013-12-24
Hi,

I am having a tough time with this one.

I have a template written in coldfusion that uploads files to the server. my only problem is I want to allow users to upload only text/html files and cfml files. Iam using cffile to upload the files but cannot get a combination of mimetypes to put in the accept that will allow me to accept .cfm files as valid files for upload... I guess I need to know what the mime type is for a cfml file right?

Does anybody know?
0
Comment
Question by:skip99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Expert Comment

by:substand
ID: 8082646
its mime type is text

you might try

"text" or "text/html" if that doesn't work

0
 
LVL 1

Author Comment

by:skip99
ID: 8082725
tried that it works for regular html files but not cfm files containing CFML code. I also took a regular HTML file and   changed  the extension to cfm it still accepted  it it doesn't work when the file contains CFML code for some reason.
0
 
LVL 1

Expert Comment

by:Malpheus
ID: 8082729
Try application/octet-stream.
Another option is to allow upload of the file, then check the file extension and delete it if it isn't what you want...

<cffile action="upload" filefield="whatever" destination="whatever">

<cfset acceptedExtensions="html,cfm">
<cfset ext=ListLast(cffile.ServerFile,".")>

<cfif not ListFind(acceptedExtensions,ext)>
 <cffile action="delete" file="whatever\#cffile.ServerFile#">
 <cfthrow message="This upload is not allowed.">
</cfif>
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 1

Author Comment

by:skip99
ID: 8082830
Thanks Malpheus, the application/octet-stream didn't work but I'm using the extension code you suggested, although it is not completely reliable it will do for now.
0
 
LVL 10

Expert Comment

by:substand
ID: 8082854
i'm not sure it would work, but try:

text/cfm
0
 
LVL 10

Expert Comment

by:substand
ID: 8082881
also, you may try:

text/x-cfm

(x denotes experimental or local mime type)
0
 
LVL 1

Accepted Solution

by:
Malpheus earned 150 total points
ID: 8083047
Also, when you submit your form, don't you get a cf error that looks like this...
-----------------------
Error processing CFFILE tag

The MIME type of the uploaded file (application/octet-stream) was not accepted by the server.
--------------------

If so, what is cf reporting as the mime type of the uploaded file? Use that in your accept parameter. What values do you currently have in your accept parameter? Are you delimiting mime-types by a comma and not a semi-colon or something?
0
 
LVL 1

Author Comment

by:skip99
ID: 8083132
Ok... I used the application/octet-stream and it worked.
I don't know why it didn't work the first time I tried  but  now it does thanks!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question