开发者

file save upload in Drupal renames to txt for js files

I am using IMCE for file uploads for css and js changes , but whenever i upload js it gets renamed to .txt files . I looked up the code and in开发者_运维知识库 upload submit in imce it uses drupal API file_save_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';
}

Its defined in includes/file.inc It doesnt give an option to over ride it as well using admin settings for allowed extensions. I really dont want to change this for standards , but other option left is to define same function with another name with allowed extensions somewhere in imce, is there any other better way to do this ? PS : I dont want to use FTP as I want users to use imce based on there profiles


Searched many places , this should have been done by a variable get method so that admin can decide what to upload and what not to upload. Only way is to hack into imce copy function rename and call this new one and in new one provide admin interface.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜