पीएचपी ftp_alloc () फ़ंक्शन
उदाहरण
फ़ाइल के लिए स्थान आवंटित करें और फ़ाइल को FTP सर्वर पर अपलोड करें:
<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
$file = "/test/myfile";
// allocate space
if (ftp_alloc($ftp_conn, filesize($file), $result))
{
echo "Space allocated on server. Sending $file.";
ftp_put($ftp_conn, "/files/myfile", $file, FTP_BINARY);
}
else
{
echo "Error! Server said: $result";
}
// close connection
ftp_close($ftp_conn);
?>
परिभाषा और उपयोग
FTP_alloc() फ़ंक्शन फ़ाइल को FTP सर्वर पर अपलोड करने के लिए स्थान आवंटित करता है।
नोट: कई FTP सर्वर इस कमांड का समर्थन नहीं करते हैं!
वाक्य - विन्यास
ftp_alloc(ftp_conn, filesize, result);
पैरामीटर मान
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
filesize | Required. Specifies the number of bytes to allocate |
result | Optional. Specifies a variable to store the server response in |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | सफलता पर सत्य, असफलता पर असत्य |
---|---|
पीएचपी संस्करण: | 5+ |
पीएचपी एफ़टीपी संदर्भ