IT/php

php ftp_nb_put - FTP 서버에 파일을 저장합니다 (비 차단).

조원태 2017. 2. 20. 22:31
반응형

ftp_nb_put - FTP 서버에 파일을 저장합니다 (비 차단).


설명 ¶


int ftp_nb_put ( resource $ftp_stream , string $remote_file , string $local_file , int $mode [, int $startpos= 0 ])

ftp_nb_put () 은 로컬 파일을 FTP 서버에 저장합니다.


이 함수와 ftp_put () 의 차이점 은이 함수가 파일을 비동기 적으로 업로드하므로 프로그램이 파일을 업로드하는 동안 다른 작업을 수행 할 수 있다는 것입니다.


매개 변수 ¶


ftp_stream

FTP 연결의 링크 식별자입니다.


remote_file

원격 파일 경로입니다.


local_file

로컬 파일 경로.


mode

전송 모드. FTP_ASCII또는 중 하나 여야합니다 FTP_BINARY.


startpos

업로드를 시작할 원격 파일의 위치입니다.


반환 값 ¶


반환 FTP_FAILED또는 FTP_FINISHED 나 FTP_MOREDATA.


예 ¶


Example # 1 ftp_nb_put () 예제


<?php


// Initiate the Upload

$ret = ftp_nb_put($my_connection, "test.remote", "test.local", FTP_BINARY);

while ($ret == FTP_MOREDATA) {

   

   // Do whatever you want

   echo ".";


   // Continue uploading...

   $ret = ftp_nb_continue($my_connection);

}

if ($ret != FTP_FINISHED) {

   echo "There was an error uploading the file...";

   exit(1);

}

?>

반응형