Reputation: 41
I write a function to export the csv data, but i don't know how to request the export url to upload the csv file to ftp server in ruby ? Who can tell me how to do?
Upvotes: 4
Views: 4023
Reputation: 407
It Worked for me you can also try this:
require 'net/ftp'
path = "tmp/"
filename = 'product.csv'
ftp = Net::FTP.new('ftp.*****.io')
ftp.login(user = "****", passwd = "******")
ftp.putbinaryfile(path + filename, filename)
ftp.quit()
Upvotes: 0
Reputation: 696
You can use net/ftp to solve this problem.
require 'net/ftp'
require 'open-uri'
Net::FTP.open('SERVER_Name', 'USER', 'Password') do |ftp|
ftp.passive = true
ftp.putbinaryfile("Your.csv")
end
Upvotes: 8