# Quick send\_data question

**URL:** <https://www.ruby-forum.com/t/quick-send-data-question/97490>\
**Category:** Rails\
**Created:** [July 7, 2006, 12:48pm UTC](https://www.ruby-forum.com/t/quick-send-data-question/97490 "2006-07-07T12:48:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshefer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sshefer](https://www.ruby-forum.com/u/sshefer)\
**Post date:** [July 7, 2006, 12:48pm UTC](https://www.ruby-forum.com/t/quick-send-data-question/97490/1 "2006-07-07T12:48:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sshefer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sshefer](https://www.ruby-forum.com/u/sshefer)\
**Post date:** [July 7, 2006, 12:51pm UTC](https://www.ruby-forum.com/t/quick-send-data-question/97490/2 "2006-07-07T12:51:01Z")

</div>

What DB are you using? Maybe there’s a (time or data) limit in your  
DB-Configuration?

---

<div class="post-metadata">

**Author:** ![sshefer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sshefer](https://www.ruby-forum.com/u/sshefer)\
**Post date:** [July 7, 2006, 3:51pm UTC](https://www.ruby-forum.com/t/quick-send-data-question/97490/3 "2006-07-07T15:51:43Z")

</div>

Daniel J. wrote:

> What DB are you using? Maybe there’s a (time or data) limit in your  
> DB-Configuration?

Im using MySQL on Dreamhost. Do they limit uploads?

---

<div class="post-metadata">

**Author:** ![sshefer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sshefer](https://www.ruby-forum.com/u/sshefer)\
**Post date:** [July 7, 2006, 8:12pm UTC](https://www.ruby-forum.com/t/quick-send-data-question/97490/4 "2006-07-07T20:12:17Z")

</div>

Daniel J. wrote:

> What DB are you using? Maybe there’s a (time or data) limit in your  
> DB-Configuration?

It seems that only 64kb of the file is uploaded to the database, is the  
rails code at fault here? I would assume that it gets cut off somewhere,  
being that 3 files I uploaded that are all different sizes sit in the  
database at 64kb.

Thanks
