Sam Donaldson wrote:> Hello,
>
> In my model, I''d like to be able to copy a remote .jpg file from a
URL:
>
> http://<doman.com>/path/picture.jpg
>
> I''d like to copy this to my local machine in my model. What
> libraries/calls could I make to make this work?
>
> Any help would be appreciated,
>
> Thanks,
>
> Sam.
Sam,
The following is what I do to send a file from MY DOMAIN to the client:
Note: Substitute your own mime-type. In this case, p.render is a
method of PDF::Writer. If you read a file into an object then it should
do the same thing (I think).
send_data p.render, :filename => "my_pdf_filename.pdf", :type
=>
"application/pdf"
OR....you can do this, but I have read some people have concerns because
it exposes your file location and any other file can subsequently be
received:
send_file( path_and_file_name, :type => "application/pdf")
Hope that helps! I''m not an expert so maybe some of the other more
senior people will have a better answer.
Michael
mmodica at cox dot net
--
Posted via http://www.ruby-forum.com/.