# Chopped files when downloading from database

**URL:** <https://www.ruby-forum.com/t/chopped-files-when-downloading-from-database/51973>\
**Category:** Rails\
**Created:** [January 9, 2006, 8:14pm UTC](https://www.ruby-forum.com/t/chopped-files-when-downloading-from-database/51973 "2006-01-09T20:14:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@marcus](https://www.ruby-forum.com/u/marcus)\
**Post date:** [January 9, 2006, 8:14pm UTC](https://www.ruby-forum.com/t/chopped-files-when-downloading-from-database/51973/1 "2006-01-09T20:14:40Z")

</div>

I have some files stored in db. When I try to download these I only get  
65535 bytes from the database even if the file is a lot bigger. Is it a  
Rails setting I’ve missed or a database setting? Anything else?

Using Rails 1.0, WinXP and MySQL4.1

/Marcus

---

<div class="post-metadata">

**Author:** ![marcus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@marcus](https://www.ruby-forum.com/u/marcus)\
**Post date:** [January 9, 2006, 8:38pm UTC](https://www.ruby-forum.com/t/chopped-files-when-downloading-from-database/51973/2 "2006-01-09T20:38:48Z")

</div>

On 1/9/06, marcus [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

You are probably storing in a database column that’s smaller than the  
file. I think the TEXT column in mysql is that long. Try switching  
to LONGTEXT. Alternately, you could just use file\_column.

–  
Kyle M.  
Chief Technologist  
E Factor Media // FN Interactive  
removed\_email\_address@domain.invalid  
1-866-263-3261

---

<div class="post-metadata">

**Author:** ![marcus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@marcus](https://www.ruby-forum.com/u/marcus)\
**Post date:** [January 9, 2006, 8:53pm UTC](https://www.ruby-forum.com/t/chopped-files-when-downloading-from-database/51973/3 "2006-01-09T20:53:52Z")

</div>

Sorry for not specifying the column type. It’s actually a blob. Is that  
also defaulted to 64k? And we don’t want to use file\_column since we  
want to store in database and not on the file system. If I’m wrong about  
this (whether it only stores to file system or not) then I’d be glad to  
hear about it.

/Marcus

---

<div class="post-metadata">

**Author:** ![marcus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@marcus](https://www.ruby-forum.com/u/marcus)\
**Post date:** [January 9, 2006, 9:21pm UTC](https://www.ruby-forum.com/t/chopped-files-when-downloading-from-database/51973/4 "2006-01-09T21:21:05Z")

</div>

Found the answer myself. A blob is 16-bit big. I’ll change it to  
longblob instead (32bit)

Thanks for the pointer though.

/Marcus
