【发布时间】:2013-03-15 03:22:27
【问题描述】:
我正在尝试通过Net::FTP 和 Perl 上传多个文件。有没有人这样做,因为我下面的基本脚本也失败了?
use Net::FTP;
use File::Basename;
my $ftp;
my $host ='56.309.24.2';
my $user ='user';
my $pw ='pass';
my $file ='097360718843.jpeg';
my $path ='public_html/uploaded/product_images';
chomp($host,$user,$pw,$path, $file);
$ftp=Net::FTP->new($host) or die "could not login";
$ftp->login($user,$pw) or die "could not login";
$ftp->cwd($path) or die "could not cwd $path";
$ftp->ls;
$ftp->put($file) or die "could not put $file";
$ftp->site("chmod 600 " . basename($file));
这是转移日志:
Net::FTP>>>
Net::FTP(2.75)
Net::FTP>>> Exporter(5.58)
Net::FTP>>>
Net::Cmd(2.26)
Net::FTP>>> IO::Socket::INET(1.27)
Net::FTP>>> IO::Socket(1.28)
Net::FTP>>> IO::Handle(1.24)
Net::FTP=GLOB(0x180c6a8)<<< 220---------- Welcome to Pure-FTPd [TLS] ----------
Net::FTP=GLOB(0x180c6a8)<<< 220-You are user number 1 of 50 allowed.
Net::FTP=GLOB(0x180c6a8)<<< 220-Local time is now 16:19. Server port: 21.
Net::FTP=GLOB(0x180c6a8)<<< 220-IPv6 connections are also welcome on this server.
Net::FTP=GLOB(0x180c6a8)<<< 220 You will be disconnected after 15 minutes of inactivity.
Net::FTP=GLOB(0x180c648)>>> user user_name
Net::FTP=GLOB(0x180c648)<<< 331 User user_name OK. Password required
Net::FTP=GLOB(0x180c648)>>> PASS ....
Net::FTP=GLOB(0x180c648)<<< 230-User user_name has group access to: user_name wheel
Net::FTP=GLOB(0x180c648)<<< 230 OK. Current restricted directory is /
Net::FTP=GLOB(0x180c648)>>> CWD public_html/uploaded/product_images/
Net::FTP=GLOB(0x180c648)<<< 250 OK. Current directory is /public_html/uploaded/product_images
Net::FTP=GLOB(0x180c648)>>> PORT 192,168,1,10,200,38
Net::FTP=GLOB(0x180c648)<<< 200 PORT command successful
Net::FTP=GLOB(0x180c648)>>> NLST
Net::FTP=GLOB(0x180c648)<<< 150 Connecting to port 50703
Net::FTP=GLOB(0x180c648)<<< 226-Options: -a
Net::FTP=GLOB(0x180c648)<<< 226 Output truncated to 2000 matches
Net::FTP=GLOB(0x180c648)>>> ALLO 7903
Net::FTP=GLOB(0x180c648)<<< 200 Zzz...
Net::FTP=GLOB(0x180c648)>>> PORT 192,168,1,10,200,39
Net::FTP=GLOB(0x180c648)<<< 200 PORT command successful
Net::FTP=GLOB(0x180c648)>>> STOR 097360718843.jpeg
Net::FTP=GLOB(0x180c648)<<< 150 Connecting to port 50704
Net::FTP=GLOB(0x180c648)<<< 226-File successfully transferred
Net::FTP=GLOB(0x180c648)<<< 226 0.381 seconds (measured here), 20.21 Kbytes per second
Net::FTP=GLOB(0x180c648)>>> SITE chmod 600 097360718843.jpeg
Net::FTP=GLOB(0x180c648)<<< 200 Permissions changed on 097360718843.jpeg
【问题讨论】:
-
脚本哪里出错了?还是脚本完成但没有上传文件?
-
已完成,但没有上传文件。
-
您如何检查文件是否已上传?根据您发布的调试日志,上传正常。
-
FTP 服务器日志说什么?
-
226-File successfully transferred表示您的文件已上传。如果它不存在于服务器上,(a) 您将其上传到您预期之外的地方;尝试查找,(b)您将其上传到错误的服务器; (c) 你的 FTP 服务器坏了。