Hi,
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 in my application controller
def download
sheet = params[:id]
@sheet = Sheet.find(sheet)
send_data(@sheet.data, :type => @sheet.content_type, :filename =>
@sheet.filename)
end
Am I just completely missing something?