Hello everybody,
I'm trying to link some files from some servers like Sharepoint to my
application.
my problem is when the link is not good, I'm redirected in a 404 error
page (which is normal :p).
I would like to know how to something like a validation method to
display the button to download if the link is correct and to display a
red button if it's not.
I tried some different things like :
def remote_file_exist?(url)
res = Net::HTTP.get_response(URI.parse(url)) rescue SocketError
res
end
Without success. Each time some files were considered as unvalide
while they were valid and vice versa.
It maybe comes from my code, that's why i continue to try other
possibilities.
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 rubyonrails-talk@googlegroups.com.
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.
No comments:
Post a Comment