1. ftp_connect : FTP서버에 연결한다.
int ftp_connect (string host [, int port])
$ftp = ftp_connect("서버주소 또는 도메인명", 21);
2. ftp_login : 계정과 패스워드로 서버에 접근한다.
int ftp_login (int ftp_stream, string username, string password)
$ftplogin = ftp_login($ftp, "$ftp_user_name", "$ftp_user_pass");
3. ftp_pwd : 현재 디렉토리 값을 리턴한다.
int ftp_pwd (int ftp_stream)
$ftp_dir = $ftp_pwd($ftp);
4. ftp_cdup : 가장 상위 디렉토리로 이동
int ftp_cdup (int ftp_stream)
$ftp_dir = $ftp_cdup($ftp);
5. ftp_chdir : FTP 디렉토리의 변경
int ftp_chdir (int ftp_stream, string directory)
$chdir = ftp_chdir($ftp, $ftp_dir);
6. ftp_mkdir : 디렉토리를 만들고 만든 디렉토리명을 반환한다.
string ftp_mkdir (int ftp_stream, string directory)
$mkdir = ftp_mkdir($ftp, "만들 디렉토리명");
7. ftp_rmdir : 디렉토리를 삭제한다.
int ftp_rmdir (int ftp_stream, string directory)
$mkdir = ftp_rmdir($ftp,"삭제할 디렉토리명");
8. ftp_nlist : 디렉토리의 파일이름을 배열로 반환한다.
int ftp_nlist (int ftp_stream, string directory)
$contents = ftp_nlist($ftp, "디렉토리명");
9. ftp_rawlist : 디렉토리의 파일이름과 읽고 쓰고 실행할 권한을 파일 당 한 줄의 배열로 반환한다.
int ftp_rawlist (int ftp_stream, string directory)
$contents = ftp_rawlist($ftp, "디렉토리명");
10. ftp_systype : FTP서버의 타입을 리턴하는데 리눅스는 UNIX로 표시해준다.
int ftp_systype (int ftp_stream)
echo ftp_systype($ftp);
11. ftp_get : FTP로부터 파일을 다운로드 받는다.
int ftp_get (int ftp_stream, string local_file, string remote_file, int mode)
$download = ftp_get($ftp, "저장할 파일명", "다운받을 파일명","FTP_ASCII or FTP_BINARY");
12. ftp_fget : FTP로부터 파일 포인터를 다운받는다.
int ftp_fget (int ftp_stream, int fp, string remote_file, int mode)
$download = ftp_fget($ftp, "저장할 파일명", "다운받을 파일명", "FTP_ASCII or FTP_BINARY");
13. ftp_put : FTP서버에 파일을 업로드 한다.
int ftp_put (int ftp_stream, string remote_file, string local_file, int mode)
$upload = ftp_put($ftp, "업로드할 파일명", "업로드될 파일명", "FTP_ASCII or FTP_BINARY");
14. ftp_fput : FTP서버에 파일 포인터를 업로드한다.
int ftp_fput (int ftp_stream, string remote_file, string local_file, int mode)
$upload = ftp_fput($ftp, "업로드할 파일명", "업로드될 파일명", "FTP_ASCII or FTP_BINARY");
15. ftp_size : 파일의 사이즈를 구한다.
int ftp_size (int ftp_stream, string remote_file)
$filesize = ftp_size($ftp, $contents[$i]);
ftp_nlist 나 ftp_rawlist에 의해 구한 파일명에 대한 배열값인 $contents[$i]에는 각 파일명과 속성이 저장되어지는데 이 파일명을 사이즈로 구하면 파일이면 사이즈가 리턴되고 디렉토리이면 -1이 리턴된다.
16. ftp_mdtm : 파일의 마지막 수정시간을 timestamp 값으로 리턴한다.
int ftp_mdtm (int ftp_stream, string remote_file)
$filemdth = ftp_size($ftp, "파일명");
17. ftp_rename : 파일명을 변경한다.
int ftp_rename (int ftp_stream, string from, string to)
$rename = ftp_rename($ftp, "바꿀 파일명", "바뀐 후 파일명");
18. ftp_delete : 해당 파일을 삭제한다.
int ftp_delete (int ftp_stream, string path)
$delfile = ftp_delete($ftp, "지울 파일명");
19. ftp_quit : 연결된 FTP의 접속을 끊는다.
int ftp_quit (int ftp_stream)
ftp_quit ($ftp);
'Backend > PHP' 카테고리의 다른 글
인증번호 6자리 (숫자) (0) | 2020.01.17 |
---|---|
csv 대용량 파일 인코딩 후 다운로드까지 (0) | 2019.11.29 |
csv 한글 인코딩 (0) | 2019.11.26 |
파일 다운로드 용량제한 풀기 (0) | 2019.11.05 |
파라미터 키값으로 변수만들기 (0) | 2019.11.05 |