Hello everybody,

I'm trying to allow users to download a file from a server (like a
Sharepoint one) with a link in my application.

Here is the view:

...
      <td id="with_icon"><%= link_to image_tag("up.png", :alt =>
"Download the document", :border => 0, :id => "icon"), d.document_url
%></td>
...

As you can see, i give an url to the link_to method. I would like to
know if the link is valid or not. I mean if it return really a file or
not.

I tried some methods like this one :

def remote_file_exist?(url)
  res = Net::HTTP.get_response(URI.parse(URI.encode(url))) rescue
SocketError
  res
end

This kind of method return an error for some valide urls and no error
for some invalide urls.

Have you any idea or suggestion ?

-- 
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.

Reply via email to