在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
基于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) 1 def respond_with_asset(asset) 2 file = params[:CKEditor].blank? ? params[:qqfile] : params[:upload] 3 asset.data = Ckeditor::Http.normalize_param(file, request) 4 …… 5 end 修改如下: 1 def respond_with_asset(asset) 2 file = params[:CKEditor].blank? ? params[:qqfile] : params[:upload] 3 extension = File.extname( file.original_filename.to_s).downcase 4 file.original_filename .replace(Time.now.strftime("%Y%m%d%H%M%S")+rand(10000).to_s+extension) 5 asset.data = Ckeditor::Http.normalize_param(file, request) 6 …… 7 end
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论