gpt4 book ai didi

ruby - 如何知道通过 ruby​​ 上传 ftp 是否成功?

转载 作者:数据小太阳 更新时间:2023-10-29 07:06:22 25 4
gpt4 key购买 nike

下面的代码通过 ftp 上传文件并且它有效。

require 'net/ftp'
ftp = Net::FTP.new
ftp.passive = true
ftp.connect("***")
ftp.login("***","***")
ftp.chdir "claimsecure-xml-files"
ftp.putbinaryfile("file.xls",File.basename("file.xls"))
ftp.quit

但是如何确定上传是否成功呢?

最佳答案

之后

    ftp.putbinaryfile("file.xls",File.basename("file.xls"))

检查

    puts ftp.last_response

关于ruby - 如何知道通过 ruby​​ 上传 ftp 是否成功?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4744307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com