putbinaryfile(localfile, remotefile = File.basename(localfile), blocksize = DEFAULT_BLOCKSIZE)
public
Transfers localfile to the server in binary mode, storing the
result in remotefile. If a block is supplied, calls it, passing in
the transmitted data in blocksize chunks.
Show source
def putbinaryfile(localfile, remotefile = File.basename(localfile),
blocksize = DEFAULT_BLOCKSIZE, &block)
if @resume
begin
rest_offset = size(remotefile)
rescue Net::FTPPermError
rest_offset = nil
end
else
rest_offset = nil
end
f = open(localfile)
begin
f.binmode
storbinary("STOR " + remotefile, f, blocksize, rest_offset, &block)
ensure
f.close
end
end