PHP Articles

Page 71 of 81

ftp_fput() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 212 Views

The ftp_fput() function is used to upload from an open file and saves it to a file on the FTP server. This function reads data from an already opened local file resource and transfers it to a remote file on the FTP server. Syntax ftp_fput(connection, remote_file, file_pointer, mode, startpos); Parameters connection − The FTP connection resource remote_file − The remote file path to upload to file_pointer − An already opened local file resource mode − The transfer mode (FTP_ASCII or FTP_BINARY) startpos − Optional. The position to begin uploading from (default is 0) ...

Read More

ftp_fget() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 311 Views

The ftp_fget() function downloads a file from an FTP server and saves it directly into an open local file resource. This function is useful when you need to download files from a remote FTP server and store them locally. Syntax ftp_fget(con, open_file, server_file, mode, startpos); Parameters con − The FTP connection resource created by ftp_connect() open_file − An open file resource where the downloaded data will be stored server_file − The path to the file on the FTP server to download mode − The transfer mode (FTP_ASCII or FTP_BINARY) startpos − The position ...

Read More

ftp_exec() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 280 Views

The ftp_exec() function is used to execute a command on the FTP server. This function is useful when you need to run server-side commands remotely through an FTP connection. Syntax ftp_exec(connection, command) Parameters connection − Required. The FTP connection resource created by ftp_connect() command − Required. The command string to execute on the FTP server Return Value The ftp_exec() function returns TRUE if the command was executed successfully, otherwise FALSE on failure. Example The following example demonstrates how to execute a command on an FTP server ?

Read More

ftp_connect() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 523 Views

The ftp_connect() function opens an FTP connection to a remote server. This function is essential for establishing FTP communication before performing file operations like upload, download, or directory management. Syntax ftp_connect(host, port, timeout); Parameters host − The FTP server to connect to. Can be a domain name or IP address. port − The port of the FTP server. Default is 21 for standard FTP connections. timeout − The timeout in seconds for network operations. Default is 90 seconds. Return Value The ftp_connect() function returns an FTP stream resource on success ...

Read More

ftp_close() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 173 Views

The ftp_close() function in PHP is used to close an active FTP connection that was previously established using ftp_connect(). This function helps free up system resources and properly terminates the connection. Syntax ftp_close($connection); Parameters $connection − The FTP connection resource to close, returned by ftp_connect(). Return Value The ftp_close() function returns TRUE on success or FALSE on failure. Example The following example demonstrates connecting to an FTP server, performing directory operations, and properly closing the connection − Key Points Always close ...

Read More

ftp_chmod() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 177 Views

The ftp_chmod() function sets permissions on a remote file via FTP. This function allows you to modify file permissions on an FTP server using octal notation, similar to the Unix chmod command. Syntax ftp_chmod(connection, mode, filename) Parameters connection − Required. The FTP connection resource mode − Required. The new permissions in octal format It consists of four digits − ...

Read More

ftp_cdup() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 205 Views

The ftp_cdup() function in PHP changes the current directory to the parent directory on an FTP server. This is equivalent to the "cd .." command in Unix/Linux systems or "cd .." in Windows command prompt. Syntax ftp_cdup($ftp_connection) Parameters The function accepts the following parameter − ftp_connection − Required. The FTP connection resource returned by ftp_connect() Return Value The ftp_cdup() function returns TRUE on success or FALSE on failure. Example The following example demonstrates how to change the current directory to the parent directory − ...

Read More

ftp_alloc() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 208 Views

The ftp_alloc() function allocates space for a file to be uploaded to the FTP server. This function is useful when uploading large files to ensure sufficient disk space is available on the server before attempting the transfer. Syntax ftp_alloc(connection, size_of_file, res); Parameters connection − The FTP connection resource to use size_of_file − The number of bytes to allocate on the server res − Optional variable to store the server response message Return Value The ftp_alloc() function returns TRUE on success or FALSE on failure. Example The following example ...

Read More

usleep() function in PHP

George John
George John
Updated on 15-Mar-2026 129 Views

The usleep() function delays execution of the current script for a specified number of microseconds. It is useful for creating pauses in script execution or controlling timing in loops. Syntax usleep(microseconds) Parameters microseconds − The number of microseconds to delay the script. One second equals 1, 000, 000 microseconds. Return Value The usleep() function returns void (nothing). Example Here's how to use usleep() to create delays in script execution ? Output The output shows timestamps with delays between them ? ...

Read More

uniqid() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 380 Views

The uniqid() function generates a unique ID based on the current time in microseconds. It's commonly used for creating temporary filenames, session IDs, or unique identifiers where collision probability needs to be minimized. Syntax uniqid(prefix, more_entropy) Parameters prefix − Optional string to prefix the unique ID. Default is empty string. more_entropy − Optional boolean. If TRUE, adds additional entropy at the end for better uniqueness. Default is FALSE. Return Value The uniqid() function returns a unique identifier as a string, typically 13 characters long (23 characters when more_entropy is TRUE). ...

Read More
Showing 701–710 of 802 articles
« Prev 1 69 70 71 72 73 81 Next »
Advertisements