I'm using acts_as_attachment plugin to store files in the database. Uploading works fine, but when I use send_data to allow users to download them, I only get the first 64K of the stream. Here's a stripped down controller:
def download_document @document = Document.find(params[:id]) send_data(@document.attachment_data, :filename => @document.filename, :type => @document.content_type, :stream => false) end
This is how acts_as_attachment is set up in the document.rb model:
acts_as_attachment :storage => :db_system, :max_size => 516.kilobytes, :content_type => ['application/pdf', 'application/msword', 'text/plain']
I'm wondering if this is a problem in my Rails code or the server setup. I'm using Lighttpd/MySQL. It has no trouble with files > 64K. send_data seems to be the sticking point.
Does anyone have any suggestions about what might going on here?
Mike