在用attachment_fu 实现图片上传时,出现了 “ Size is not included ” 问题,找了好久终于找到了解决方法。
不知道是不是最好的方法,但是很好用,具体操作如下
进入attachment_fu 文件夹修改attachment_fu.rb 文件
1.将 uploaded_data=(file_data) 方法修改为
def uploaded_data=(file_data)
return nil if file_data.nil? || file_data.size == 0
#下一行为增加的代码
self.size = file_data.size
self.content_type = file_data.content_type
self.filename = file_data.original_filename if respond_to?(:filename)
if file_data.is_a?(StringIO)
file_data.rewind
self.temp_data = file_data.read
else
self.temp_path = file_data.path
end
end
2.修改文件下部protected部分的 set_size_from_temp_path 方法
def set_size_from_temp_path
self.size = File.size(temp_path) if save_attachment? && (self.size == 0 || self.size.nil?)
end
修改之后再重启服务器即可。
分享到:
相关推荐
AT_Attachment_with_Packet_Interface_-_7_Volume_3
_storage_emulated_0_android_data_com.tencent.mm_MicroMsg_517174082dbc007f25c5bd836bdd4446_attachment_段润昌_648.wps
ATA接口的详细解读,working draft proposed American National Standard for Information Systems - ATA (ATAttachment) 78页
USER text not null MANAGE_USER text not null ADD_SHARE_NAME varchar(11) not null ATTACHMENT_ID text not null ATTACHMENT_NAME text not null ADD_START datetime not null ADD_END datetime not null 1.1.1.2...
_storage_emulated_0_android_data_com.tencent.mm_MicroMsg_7cef220aad1703aed0c0f4bb62bea90d_attachment_1_实验四(1) .docx
个人博客:https://blog.csdn.net/MissXy_/article/details/83347968 参考使用;
Information Technology - AT Attachment with Packet Interface - 6 (ATA/ATAPI-6)ATA_ATAPI-6标准规范,驱动开发参考文档
生成四角、八角、十六角的方位标志。方便做图例。
用于LTE中下行物理链路中CRC添加的程序
very interesting matlab hev model
CREATE TABLE attachment ( attachment_id bigint(20)NOT NULL AUTO_INCREMENT, attachment_data longblob, attachment_name varchar(255)默认值, attachment_type varchar(255)默认值NULL,主键( ...
西门子840d数控系统说明。对方的更多更好
attachment_doc是一个SquirrelMail插件,允许用户使用其浏览器查看电子邮件中的文档附件。 该插件将文档转换为html格式。 目前支持MSWord(DOC)和可移植文档格式(PDF)!
This is the seventh ATA/ATAPI standard. Released in 2003. This standard specifies the AT Attachment Interface between host systems and storage devices. It provides a common attachment interface for ...
Attachment_Project 附件项目
1649480820617212_attachment.cgi
attachment_repo 我要分享的一些文件
Filament winding path generation
Salesforce Attachment mover是用Node.js编写的命令行应用程序,执行3种操作 从CSV文件导入附件 将附件导出到本地zip文件 执行附件的组织迁移 要运行此程序,请打开命令提示符,指向安装应用程序的目录并运行: ...
fdafdaafdasfdafdfdsafdadfdsafdsa