Re: Uploading a file - undefined method `bytesize' for true:TrueClass

Skip to first unread message

Hans Hasselberg

Jun 8, 2013, 6:32:43 PM6/8/13
Hey Glenn,

could you open an issue on github with code to reproduce b/c I'm not able to. Please also mention which version of Typhoeus you are running.


On Tue, Jun 4, 2013 at 11:31 PM, Glenn Daneels <> wrote:
Hi all,

I'm trying to upload a file and some other data using following code:

                                response =
                                {       :method => :post,
                                        :headers => { "Authorization" => "Token #{@token}", :accept => "application/json" },
                                        :body => {      :image_uri =>"#{template["local_uri"]}", 'rb'),
                                                        :name => template["name"],
                                                        :description => template["description"],
                                                        :type => template["type"],
                                                        :node_archs => template["node_archs"],
                                                        :is_active => true

But I keep getting following error: "undefined method `bytesize' for true:TrueClass"

I also tried it with :image_uri =>"#{template["local_uri"]}", 'rb') but this had the same result...
The variable template["local_uri"] is equal to "/home/glenn/omf-openwrt-testing-rootfs-latest.tar.gz"

I'm using Ruby 1.8.7.

Do I need to add/change something (some headers or something)? 
Could someone please help me along?

Thanks in advance,

You received this message because you are subscribed to the Google Groups "Typhoeus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages