ftp_alloc() 함수는 FTP 서버에 업로드할 파일을 위한 공간을 할당합니다.
구문
ftp_alloc(connection,size_of_file,res);
매개변수
-
연결 − 사용할 FTP 연결
-
size_of_file - 할당할 바이트 수
-
해상도 - 서버 응답을 저장할 변수
반환
ftp_alloc() 함수는 성공하면 TRUE를, 실패하면 FALSE를 반환합니다.
예시
다음은 예입니다 -
<?php
$myFile = "demo.txt";
$con = ftp_connect('192.168.0.4');
$login_result = ftp_login($con, 'yuvgj2j', 'yuvgj2j');
if (ftp_alloc($con, filesize($myFile), $res)) {
echo "Sending $file\n";
ftp_put($con, 'D:/ds', $myFile, FTP_BINARY);
} else {
echo "Failed in allocating space! Message = $res\n";
}
ftp_close($con);
?>