Rails 3.1 和 CKEditor w Carrierwave,无法上传

发布于 2024-12-22 07:38:43 字数 197 浏览 4 评论 0原文

上传文件对我来说不起作用。文件确实被保存,但查看参数,CKeditor 没有发送真实性令牌。因此,我收到“无法验证 CSRF 真实性”警告,这会重置会话,然后我无法更新帖子。

令牌在表单中设置,但 CKEditor 似乎没有发送它以进行图片或文件上传。我认为当我将 CKE 与 Paperclip 一起使用时,这可能没问题,但不确定。所有其他 CKE 操作均有效。

Uploading files won't work for me. The file does get saved but looking at the parameters there is no authenticity token sent by CKeditor. So I get a "Can't verify CSRF authenticity" warning, which resets the session, then I can't update the post.

The token is set in the form but CKEditor doesn't seem to send it for picture or file uploads. I think this may have been OK when I used CKE with Paperclip, but not certain of that. All other CKE operations work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最美的太阳 2024-12-29 07:38:43

回答于 Ruby on Rails:让 CKeditor 上传图像时出现问题

需要跳过验证

skip_before_filter :verify_authenticity_token, :only => [:new_from_disk]

Answered at Ruby on Rails: problem getting CKeditor to upload images

You need to skip verification

skip_before_filter :verify_authenticity_token, :only => [:new_from_disk]
也只是曾经 2024-12-29 07:38:43

请参阅 ckeditor 代码:

class Ckeditor::ApplicationController < ::ApplicationController

请添加一些类似的代码:

skip_before_filter :verify_authenticity_token    

Please see the ckeditor code:

class Ckeditor::ApplicationController < ::ApplicationController

Please add some alike:

skip_before_filter :verify_authenticity_token    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文