在ColdFusion中确定文件的MIME类型的问题 [英] Problems determining a file's mime type in ColdFusion

查看:122
本文介绍了在ColdFusion中确定文件的MIME类型的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 getPageContext()。getServletContext()。getMimeType()确定文件的MIME类型时,它返回 undefined 如果扩展名是大写(例如, image.JPG )。有没有人遇到这个?我知道有 FileGetMimeType ,但是给我另一个问题在代码库里面,我在工作。我在运行ColdFusion 10。

解决方案

这似乎是一个回归在ColdFusion 10(它在CF9工作正常)。我会通过提出一个错误的动议,但Adobe会更多地说一个或多个:


  1. 目的;

  2. 这是因为它是控制,因为它是处理这种事情的Tomcat;

  3. 这些方法在CFML中没有记录, 记录在 ServletContext spec

没有什么特别令人满意, / p>

TBH,我只是小写文件名,然后传递给函数。这不是它需要是真实文件的实际名称


When I try to determine a file's mime type with getPageContext().getServletContext().getMimeType(), it returns undefined if the extension is in uppercase (e.g., image.JPG). Has anyone run into this before? I know there is FileGetMimeType, but that gives me another set of issues within the codebase in which I'm working. I am running ColdFusion 10.

解决方案

This appears to be a regression in ColdFusion 10 (it works fine on CF9). I'd go through the motions of raising a bug, but Adobe will more than likely say one or more of:

  1. it's that way on purpose;
  2. it's outwith their control because it's Tomcat that deals with that sort of thing;
  3. those methods are undocumented in CFML therefore unsupported (although they are documented in the ServletContext spec)

None are particularly satisfactory, but it's an easy out for Adobe.

TBH, I'd just lowercase the filename before passing it to the function. It's not like it needs to be the actual name of a real file.

这篇关于在ColdFusion中确定文件的MIME类型的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆