# Amazon s3 rails file download issue

**URL:** <https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571>\
**Category:** Rails\
**Created:** [January 30, 2010, 5:16am UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571 "2010-01-30T05:16:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [January 30, 2010, 5:16am UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/1 "2010-01-30T05:16:40Z")

</div>

I am trying to get a file from the amazon bucket but it says “string  
contains null byte”. any idea how to get the file to download like a  
regular file? The file is there at the location.

f = Heypub.value @bucket  
send\_file( f , :type =\> “FileExtns[ext][‘mime’]”, :disposition =\>  
‘attachment’)

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [January 30, 2010, 10:24pm UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/2 "2010-01-30T22:24:14Z")

</div>

Anyone? I can see the file contents in the log file if I logger.info  
f.

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [January 31, 2010, 4:57pm UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/3 "2010-01-31T16:57:17Z")

</div>

or this version is the same thing:

f = S3Object.value @bucket, ‘mybucket’

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 1, 2010, 2:09am UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/4 "2010-02-01T02:09:44Z")

</div>

Verify it the file is ok first by writing to the filesystem.

You may need to attempt to isolate the problem without much information.

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 1, 2010, 2:13am UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/5 "2010-02-01T02:13:15Z")

</div>

I did, gives me the same error. no idea what could be the issue. seems  
like  
a send\_file issue??

On Sun, Jan 31, 2010 at 7:07 PM, Curtis S. \<

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 1, 2010, 9:18am UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/6 "2010-02-01T09:18:11Z")

</div>

also are you using [http://amazon.rubyforge.org/](http://amazon.rubyforge.org/) ?

the examples that it presents look similar to yours.

On Sun, Jan 31, 2010 at 5:07 PM, Curtis S. \<

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 1, 2010, 2:17am UTC](https://www.ruby-forum.com/t/amazon-s3-rails-file-download-issue/182571/7 "2010-02-01T02:17:56Z")

</div>

It gives you the same error?

I mean open a file and write it to the server. open(‘filename.png’,‘w’)  
do |  
etc.

If the above and send files gives you the same error s very likely that  
you  
are using the api mistaken and need to check your assumptions and  
understanding carefully.
