使用ftp_put上传到服务器时出现问题

时间:2014-07-10 16:24:00

标签: php ftp

继承我的代码:

                $host = 'ftp.uscdls.com'; 
                $usr = 'something'; 
                $pwd = 'something';         
                $local_file = 'img.png'; 
                $ftp_path = '/www.something.com'; 
                $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");      
                ftp_pasv($conn_id, true); 
                ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); 
                // perform file upload 
                ftp_chdir($conn_id, 'load_uploads'); 
                $upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII); 
                if($upload) { $ftpsucc=1; } else { $ftpsucc=0; } 
                // check upload status: 
                print (!$upload) ? 'Cannot upload' : 'Upload complete'; 
                print "\n"; 
                // close the FTP stream 
                ftp_close($conn_id); 

它在输出“无法上传”的行上失败了。我已经重写了几次,我一直得到同样的错误。希望有人对此有更好的认识。再次非常感谢任何帮助!!谢谢!

0 个答案:

没有答案