Displaying 1 result from an estimated 1 matches for "document_field".
2006 Jul 07
3
quick send_data question...
...,
I am using send_data to allow users to download files from the database
but ran into a small problem, it seems that files upload fine but when
they download only 64kb of the file is sent.
I''m using the basic rails code from the Agile book:
#upload code in my sheet model
def file=(document_field)
self.filename = base_part_of(document_field.original_filename)
self.content_type = document_field.content_type.chomp
self.data = document_field.read
end
def base_part_of(file_name)
name = File.basename(file_name)
name.gsub(/[^\w._-]/, '''')
end
#download...