Uploading files to an FTP server is only possible if you have write permissions on the server in the directory to which you want to upload. Therefore, none of the examples in this section will work unedited, as you can’t provide an FTP server with write access (for obvious reasons!).
Uploading is the exact opposite of downloading, and net/ftp provides putbinaryfile and puttextfile methods that accept the same parameters as getbinaryfile and get-textfile. The first parameter is the name of the local file you want to upload, the optional second parameter is the name to give the file on the remote server (defaults to thesame as the uploaded file’s name if omitted), and the optional third parameter for putbinaryfile is the block size to use for the upload. Here’s an upload example:

require 'net/ftp'
ftp = Net::FTP.new('ftp.domain.com')
ftp.passive = true