Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2003-03-06
8
Medium Priority
?
2,079 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
  • 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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

571 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