I think I found how to do it
file = StringIO.new(part.decoded)
file.class.class_eval
{ attr_accessor :original_filename, :content_type }
file.original_filename = part.filename
file.content_type = part.mime_type
fields_hash = { :description => "uploaded file", :name =>
''test''}
response = RestClient.post
''http://localhost:3000/en_GB/clips'',
fields_hash.merge(:file => file)
On Jul 13, 4:55 pm, Erwin <yves_duf...-ee4meeAH724@public.gmane.org>
wrote:> I get the email attachment.. as email.part
>
> #<Mail::Part:2167989640, Multipart: false, Headers: <Content-Type:
> video/x-m4v; x-unix-mode=0644; name=clipout12_iPhone.m4v>, <Content-
> Transfer-Encoding: base64>, <Content-Disposition: attachment;
> filename=clipout12_iPhone.m4v>>
>
> and I would like to do a remote POST (using RestClient) it in a
> multipart form like :
>
> RestClient.post ''http://localhost:3000/foo'',
fields_hash.merge(:file
> => File.new(''/path/to/file''))
>
> should I store the email.part as a temp file and reuse this temp file
> in the post ?
> or
> is there any way to post directly the content as a file ?
>
> thanks for your suggestions
>
> erwin
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.