[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Remote files?

rduby1

3/25/2008 10:26:00 AM

I need to read the contents of 2 files on a remote webserver, for
example: http://www.domain.com/bo...

The first file is a plain-text file and the other is a binary file
(photo).

Text file:
I need to read the text and keep in memory

Binary file:
Basically I just need to move the contents to my own server and store
it in a new file.

Can anyone send me on the right track?
3 Answers

Jano Svitok

3/25/2008 11:16:00 AM

0

On Tue, Mar 25, 2008 at 11:30 AM, <rduby1@gmail.com> wrote:
> I need to read the contents of 2 files on a remote webserver, for
> example: http://www.domain.com/bo...
>
> The first file is a plain-text file and the other is a binary file
> (photo).
>
> Text file:
> I need to read the text and keep in memory
>
> Binary file:
> Basically I just need to move the contents to my own server and store
> it in a new file.
>
> Can anyone send me on the right track?

open-uri, net/http

Thomas Wieczorek

3/25/2008 12:53:00 PM

0

On Tue, Mar 25, 2008 at 11:30 AM, <rduby1@gmail.com> wrote:
>
> The first file is a plain-text file and the other is a binary file
> (photo).
>

Take a look at http://www.rubynoob.com/articles/2006/8/21/how-to-download-files-with-a-r...
Notice "wb" in _open("fun.jpg", "wb")_, it is important, when you
download images on windows platforms otherwise it will open them in
ASCII mode.

rduby1

3/25/2008 3:03:00 PM

0

On 25 Mar., 13:53, Thomas Wieczorek <wieczo...@googlemail.com> wrote:
> On Tue, Mar 25, 2008 at 11:30 AM,  <rdu...@gmail.com> wrote:
>
> >  The first file is a plain-text file and the other is a binary file
> >  (photo).
>
> Take a look athttp://www.rubynoob.com/articles/2006/8/21/how-to-download-......
> Notice "wb" in _open("fun.jpg", "wb")_, it is important, when you
> download images on windows platforms otherwise it will open them in
> ASCII mode.

Hi,

thanks a lot for the answers. It works :-)