Hi Bennet,
On 12 May 2009, at 13:07, PyroHiroshi wrote:
> On May 11, 12:39 pm, Frederick Cheung <[email protected]>
> wrote:
>> On May 11, 11:11 am, "hongseok.com" <[email protected]> wrote:
>>>>> I just want the client(kind a application running automatically)
>>>>> to
>>>>>
>>>>>> uploadfileto the web server as it wants. How do I do this?
>> you'll need to construct an appropriate post request (read up on
>> multipart post requests) containing the file
>
> This is exactly what I've been trying to do all day. Not as easy as
> you'd think. There are absolutely no examples of this available
> anywhere.
The mechanize gem makes file uploads a no-brainer...
Check out their example script which automates file uploads to Flickr
in 10 or so lines of Ruby code:
http://github.com/tenderlove/mechanize/blob/a5d73af1f7f4f8d6889b6da68899b9357a63b847/examples/flickr_upload.rb
Also check out the mechanize homepage for more examples and API
documentation:
http://mechanize.rubyforge.org/mechanize/
Mechanize FTW! ;-)
Peter
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---