The PHP Function Ftp_Put()
The ftp_put() function is a built-in PHP function that allows you to upload a local file to an FTP server. The php ftp_put() function takes the connection identifier, the remote file path, and the local file path as parameters. You can also specify the transfer mode and the start position in the remote file. The ftp_put() function returns True if the file was uploaded successfully, or False if an error occurred.
The FTP extension for PHP makes it easy to connect to file servers and perform various file operations, including transferring files between hosts. It provides a number of functions to open, login and close connections, as well as upload, download, rename, delete and get information on files from the server. The ftp_put() is one of these functions and, with proper usage and error handling, can be a useful tool in your PHP applications.
Hacking with PHP is now updated for PHP 7. Learn from over 1200 pages of hands-on learning. Get the book today!
The php ftp_put() is an inbuilt function that allows you to upload a local php file into an ftp server. The function takes the ftp_connection (a connection identifier), the remote file path, the local file path and the transfer mode as parameters. The ftp_put() method can also be used to create and remove directories on the ftp server. This is particularly helpful when your web host uses the user 'nobody' for all sessions and you want to manage your own directories.