我正在验证 Carrierwave 上传的大小。它在本地主机上运行良好,但在服务器(Amazon EC2)上,当我尝试上传大于 1MB 的文件时出现以下错误(这是限制):
POST http://mysubdomain.mysite.com/authors/484.js /authors/484.js:1
Unsafe JavaScript attempt to access frame with URL data:text/html,chromewebdata from frame with URL http://mysubdomain.mysite.com/. The frame requesting access has a protocol of 'http', the frame being accessed has a protocol of ''. Protocols must match.
default.js:17
484.js /authors POST (failed) Pending Other 13 B 0 B 1.0 min
data:image/png;base… GET Success image/png data:text/html,chromewebdata:159 Parser 0 B 2.3 KB 0 ms 0 0 ms
在发生错误的行 default.js:17 中,我看到 JQuery 代码(缩小)
这就是我验证图像的方式:
mount_uploader :image_one, AuthorPixUploader
validates :image_one,
:file_size => {
:maximum => 1.megabytes.to_i
}
有什么帮助吗?我认为它在失败到达服务器之前失败了。我不知道。