0

PHP FTP Functions

Posted by jujur on 5:47 AM

PHP FTP Functions


PHP FTP Introduction

The FTP functions give client access to file servers through the File Transfer Protocol (FTP).
The FTP functions are used to open, login and close connections, as well as upload, download, rename, delete, and get information on files from file servers. Not all of the FTP functions will work with every server or return the same results. The FTP functions became available with PHP 3.
These functions are meant for detailed access to an FTP server. If you only wish to read from or write to a file on an FTP server, consider using the ftp:// wrapper with the Filesystem functions.

Installation

The windows version of PHP has built-in support for the FTP extension. So, the FTP functions will work automatically.
However, if you are running the Linux version of PHP, you will have to compile PHP with --enable-ftp (PHP 4+) or --with-ftp (PHP 3) to get the FTP functions to work.

PHP FTP Functions

PHP: indicates the earliest version of PHP that supports the function.
Function
Description
PHP
Allocates space for a file to be uploaded to the FTP server
5
Changes the current directory to the parent directory on the FTP server
3
Changes the current directory on the FTP server
3
Sets permissions on a file via FTP
5
Closes an FTP connection
4
Opens an FTP connection
3
Deletes a file on the FTP server
3
Executes a program/command on the FTP server
4
Downloads a file from the FTP server and saves it to an open file
3
Uploads from an open file and saves it to a file on the FTP server
3
Returns runtime behaviors of the FTP connection
4
Downloads a file from the FTP server
3
Logs on to an FTP connection
3
Returns the last modified time of a specified file
3
Creates a new directory on the FTP server
3
Continues retrieving/sending a file (non-blocking)
4
Downloads a file from the FTP server and saves it to an open file (non-blocking)
4
Uploads from an open file and saves it to a file on the FTP server (non-blocking)
4
Downloads a file from the FTP server (non-blocking)
4
Uploads a file to the FTP server (non-blocking)
4
Lists the files in a specified directory on the FTP server
3
Turns passive mode on or off
3
Uploads a file to the FTP server
3
Returns the current directory name
3
Alias of ftp_close()
3
Sends a raw command to the FTP server
5
Returns a detailed list of files in the specified directory
3
Renames a file or directory on the FTP server
3
Removes a directory on the FTP server
3
Sets runtime options for the FTP connection
4
Sends a SITE command to the server
3
Returns the size of the specified file
3
Opens a secure SSL-FTP connection
4
Returns the system type identifier of the FTP server
3


PHP FTP Constants

PHP: indicates the earliest version of PHP that supports the constant.
Constant
Description
PHP
FTP_ASCII

3
FTP_TEXT

3
FTP_BINARY

3
FTP_IMAGE

3
FTP_TIMEOUT_SEC

3
FTP_AUTOSEEK

4
FTP_AUTORESUME
Determine resume position and start position for get and put requests automatically
4
FTP_FAILED
Asynchronous transfer has failed
4
FTP_FINISHED
Asynchronous transfer has finished
4
FTP_MOREDATA
Asynchronous transfer is still active
4




0 Comments

Copyright Jujur Soaloon Sitangang Lipan All rights reserved. Theme by Sitanggang. | Bloggerized by Soalparna.