Drupal中的文件保存上载将js文件重命名为txt

Drupal中的文件保存上载将js文件重命名为txt,drupal,file-upload,drupal-6,drupal-modules,Drupal,File Upload,Drupal 6,Drupal Modules,我使用IMCE上传css和js更改的文件,但每当我上传js时,它就会被重命名为.txt文件。我查阅了代码,在imce的upload submit中,它使用drupal API文件\u save\u upload // Rename potentially executable files, to help prevent exploits. if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) &&

我使用IMCE上传css和js更改的文件,但每当我上传js时,它就会被重命名为.txt文件。我查阅了代码,在imce的upload submit中,它使用drupal API文件\u save\u upload

// Rename potentially executable files, to help prevent exploits.
if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
  $file->filemime = 'text/plain';
  $file->filepath .= '.txt';
  $file->filename .= '.txt';
}
它在
includes/file.inc
中定义,它没有提供一个选项,也没有为允许的扩展使用管理员设置来覆盖它。我真的不想为标准改变这一点,但剩下的另一个选项是用imce中的某个地方允许的扩展名用另一个名称定义同一个函数,还有其他更好的方法吗?
PS:我不想使用FTP,因为我希望用户使用imce时基于这些配置文件

搜索了很多地方,这应该通过变量get方法完成,以便管理员可以决定上传什么和不上传什么。
唯一的方法是侵入imce复制函数重命名并调用这个新函数,然后在新函数中提供管理界面。

在Drupal 7中,您可以设置
allow\u unsecure\u uploads
,如中所述,改为编辑服务器配置,以确保在用户请求时服务器不会执行文件。