ฟังก์ชัน ftp_alloc()
ความหมายของฟังก์ชันและการใช้งาน
การจองพื้นที่สำหรับอัพโหลดไฟล์ด้วยฟังก์ชัน ftp_alloc()
รูปแบบการเขียน (Syntax)
ftp_alloc(ftp_connection, size, return)
- ftp_connection คือ resource ที่ได้จากฟังก์ชัน ftp_connect()
- port คือ จำนวนของ byte ที่ต้องการจองพื้นที่
- return คือ ตัวแปรที่จะรับข้อความที่ตอบกลับจาก ftp servers โดยเป็นการรับค่าแบบ reference
ตัวอย่าง
<?php
$file = "examplefile.txt";
$conn = ftp_connect("ftp.exampleftp.com") or die("Could not connect");
ftp_login($conn,"testusername","testpassword");
ftp_alloc($conn,filesize($file),$response);
echo $response;
ftp_close($conn);
?>