Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload the csv file to ftp server in rails?

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?

like image 685
jackmin Avatar asked Oct 16 '25 18:10

jackmin


1 Answers

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
like image 65
Mashpy Rahman Avatar answered Oct 18 '25 10:10

Mashpy Rahman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!