Upload an image on server

Hello,

I am new to ruby and ruby on rails and I am looking for a way to upload
an image on a server.
I tried with the ruby http.post method :

http.post(‘serveraddress’, image) but it does no seem to work.

Also is there a way to send a file to a server with this method ?

Thanks !