php를 사용하여 URL에서 ftp로 이미지를 업로드하는 방법은 무엇입니까? php를 사용하여 ftp를 통해 URL에서 파일을 업로드하는 방법은 무엇입니까?
는 FTP로 URL에서 이미지를 업로드 할예 : http://test.com/imagefile.jpg 또는
http://test.com/testvideo.flv 나는
내가 여기 예제 코드를 가지고, 해당 파일은 FTP 또는 컬 PHP를 통해 업로드하고 싶지만은 '아무튼 일하지 마라.파일이 없습니다.
$ftp_server ="ftp.yoursite.com"
$ftp_user ="yoursite user"
$ftp_password = "yoursite pass"
$file_to_upload = "http://test.com/imagefile.png";
$remote_location = "/test";
// set up connection or exit with message
$flink = ftp_connect($ftp_server) or exit("Can't connect to ftp server: $ftp_server");
// login or at least try
if(ftp_login($flink, $ftp_user, $ftp_password)) {
// if login successful use ftp_put to upload the file
// if you upload binary files use mode FTP_BINARY
if(ftp_put($flink, $remote_location, $file_to_upload, FTP_ASCII)) {
echo "Success! File is uploaded!";
} else {
echo "Can't upload file";
}
} else {
echo "Can't login with this user & password";
}
// close the connection
ftp_close($flink);
누구든이 문제를 해결할 수 있습니까? 아니면 누구나 이보다 더 좋은 제안을 할 수 있습니까? 감사합니다. 도움을 많이 주셔서 감사합니다.
$의 file_to_upload는 로컬 파일 할 필요가 당신의 ftp_put을 사용하는 경우 서버. – subroutines