基于rails4.0环境

当使用Ckeditor上传中文命名图片时报错,解决方法是对图片进行重命名

在Ckeditor插件的安装目录下找到controllers/.../application.rb

比如:E:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\ckeditor-4.0.4\app\controllers\ckeditor\application.rb

然后找到 def respond_with_asset(asset)

 def respond_with_asset(asset)
file = params[:CKEditor].blank? ? params[:qqfile] : params[:upload]
asset.data = Ckeditor::Http.normalize_param(file, request)
……
end

修改如下:

 def respond_with_asset(asset)
file = params[:CKEditor].blank? ? params[:qqfile] : params[:upload]
extension = File.extname( file.original_filename.to_s).downcase
file.original_filename .replace(Time.now.strftime("%Y%m%d%H%M%S")+rand(10000).to_s+extension)
asset.data = Ckeditor::Http.normalize_param(file, request)
……
end

ruby -- 进阶学习(五)使用Ckeditor插件上传中文图片的更多相关文章

  1. ruby -- 进阶学习(四)paperclip上传中文命名图片

         Paperclip -- 上传中文命名图片 使用Paperclip和ImageMagick插件来处理图片的时候,上传非中文命名的图片时,只要把配置写好就没问题 if you need to ...

  2. 《五》uploadify插件上传文件

    下载地址:http://www.uploadify.com/wp-content/uploads/files/uploadify.zip 相关配置:http://www.uploadify.com/d ...

  3. $cordovaCamera 插件 上传头像 图片功能

    首先要注入  $cordovaCamera 使用相机拍照 var useCamera = function() { var options = { //这些参数可能要配合着使用,比如选择了source ...

  4. easyui+webuploader+ckeditor实现插件式多图片上传-添加图片权限(图片上传人是谁,只能看到自己的图片)

    需求: 实现过程及思路 1.先页面布局 <html xmlns="http://www.w3.org/1999/xhtml"> <head runat=" ...

  5. MVC&WebForm对照学习:文件上传(以图片为例)

    原文  http://www.tuicool.com/articles/myM7fe 主题 HTMLMVC模式Asp.net 博客园::首页::  ::  ::  ::管理 5 Posts :: 0 ...

  6. 基于spring-boot的web应用,ckeditor上传文件图片文件

    说来惭愧,这个应用调试,折腾了我一整天,google了很多帖子,才算整明白,今天在这里做个记录和分享吧,也作为自己后续的参考! 第一步,ckeditor(本博文论及的ckeditor版本4.5.6)的 ...

  7. ckeditor 4.2.1_演示 ckeditor 上传&插入图片

    本文内容 FineUI ckeditor fckeditor/ckeditor 演示 ckeditor 4.2.1 上传&插入图片 最近看了一下 FineUI_v3.3.1 控件,对里边的 c ...

  8. PHP 多图上传,图片批量上传插件,webuploader.js,百度文件上传插件

    PHP  多图上传,图片批量上传插件,webuploader.js,百度文件上传插件(案例教程) WebUploader作用:http://fex.baidu.com/webuploader/gett ...

  9. tinymce4.x 上传本地图片(自己写个插件)

    tinymce是一款挺不错的html文本编辑器.但是添加图片是直接添加链接,不能直接选择本地图片. 下面我写了一个插件用于直接上传本地图片. 在tinymce的plugins目录下新建一个upload ...

随机推荐

  1. Android 代理服务器为全网提供代理

    Android 代理服务器为全网提供代理 背景:学校WiFI过滤较严,故学生很少有可以上网账号的.而学校又分为俩层验证,第一层可以注册并且拥有访问校内网的权限,第二层为校内密码验证机(非服务器)进行用 ...

  2. Leetcode-462 Minimum Moves to Equal Array Elements II

    #462.   Minimum Moves to Equal Array Elements II Given a non-empty integer array, find the minimum n ...

  3. python遍历数据

    #coding=utf-8 import MySQLdb conn = MySQLdb.Connect(host = '127.0.0.1',port=3306,user='root',passwd= ...

  4. Android:改变Activity切换方式(转载)

    overridePendingTransition(enterAnim, exitAnim); Intent intent =new Intent(this,item2.class); startAc ...

  5. android: 后台执行的定时任务

    Android 中的定时任务一般有两种实现方式,一种是使用 Java API 里提供的 Timer 类, 一种是使用 Android 的 Alarm 机制.这两种方式在多数情况下都能实现类似的效果,但 ...

  6. AppExchange Partner Keynote

    Kick-off Dreamforce at the AppExchange Partner Keynote and hear from industry experts about the tren ...

  7. Ay.Framework.WPF 2.0建立项目到底有多快

    2015-3-31 今天我已经优化了很多地方,让客户使用起来几乎是傻瓜式使用了,废话不多说,我们开始吧. 默认的我提供了一些图片,但是也只占用了8M多,2.0版本目前总共有45M左右大小,毕竟包含了f ...

  8. BZOJ 4726: [POI2017]Sabota? 树形dp

    4726: [POI2017]Sabota? 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=4726 Description 某个公司有n ...

  9. [数据库]SQL Server 用户NT AUTHORITY\IUSR 登录失败

    今天打开网站时,突然报这个错误,平时都好好的 Cannot open database "JMECC" requested by the login. The login fail ...

  10. canvas应用-思维导图

    canvas应用例子-思维导图 效果图如下: 函数说明: // 求圆上一点坐标,返回坐标点 function circlePoint(x, y, r, a) { var tmpx = x + r * ...