- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_alloc() function in PHP
The ftp_alloc() function allocates space for a file to be uploaded to the FTP server.
Syntax
ftp_alloc(connection,size_of_file,res);
Parameters
connection − The FTP connection to use
size_of_file − The number of bytes to allocate
res − A variable to store the server response
Return
The ftp_alloc() function returns TRUE on success or FALSE on failure
Example
The following is an example −
<?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
"; ftp_put($con, 'D:/ds', $myFile, FTP_BINARY); } else { echo "Failed in allocating space! Message = $res
"; } ftp_close($con); ?>
Advertisements