ftp_alloc(3) php man page | unix.com

Man Page: ftp_alloc

Operating Environment: php

Section: 3

FTP_ALLOC(3)								 1							      FTP_ALLOC(3)

ftp_alloc - Allocates space for a file to be uploaded

SYNOPSIS
bool ftp_alloc (resource $ftp_stream, int $filesize, [string &$result])
DESCRIPTION
Sends an ALLO command to the remote FTP server to allocate space for a file to be uploaded. Note Many FTP servers do not support this command. These servers may return a failure code ( FALSE) indicating the command is not sup- ported or a success code ( TRUE) to indicate that pre-allocation is not necessary and the client should continue as though the oper- ation were successful. Because of this, it may be best to reserve this function for servers which explicitly require preallocation.
PARAMETERS
o $ftp_stream - The link identifier of the FTP connection. o $filesize - The number of bytes to allocate. o $result - A textual representation of the servers response will be returned by reference in $result if a variable is provided.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1 ftp_alloc(3) example <?php $file = "/home/user/myfile"; // connect to the server $conn_id = ftp_connect('ftp.example.com'); $login_result = ftp_login($conn_id, 'anonymous', 'user@example.com'); if (ftp_alloc($conn_id, filesize($file), $result)) { echo "Space successfully allocated on server. Sending $file. "; ftp_put($conn_id, '/incomming/myfile', $file, FTP_BINARY); } else { echo "Unable to allocate space on server. Server said: $result "; } ftp_close($conn_id); ?>
SEE ALSO
ftp_put(3), ftp_fput(3). PHP Documentation Group FTP_ALLOC(3)
Related Man Pages
ftp_get_option(3) - php
ftp_chdir(3) - php
ftp_fput(3) - php
ftp_mdtm(3) - php
ftp_nb_fget(3) - php
Similar Topics in the Unix Linux Community
UNIX and filesize
getting filesize
Filesize not working
Space Problem in Unix Server
Unable to use FTP command to connect from one server to another