Re: send_data bombs out after 64K

Jonathan Viney
Sat, 13 Jan 2007 13:25:54 -0000

Make sure the database column is big enough for the data. You''ve
probably
got a column type that holds 64kb.

-Jonathan.

On 1/12/07, mjpowers <mpowers1-ee4meeAH724@public.gmane.org>
wrote:
>
>
> 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
>
>
> >
>