ftp_set_option() function in PHP


The ftp_set_option() function sets runtime options for the FTP connection.

Syntax

ftp_set_option(conn,option,value);

Parameters

  • conn − The FTP connection

  • option − The runtime option to set. The following are the possible values:

    - FTP_TIMEOUT_SEC

    - FTP_AUTOSEEK

  • value − The value of the option parameter set above

Return

The ftp_set_option() function returns TRUE if the option could be set, or FALSE.

Example

The following is an example −

<?php
   $ftp_server = "192.168.0.4";
   $ftp_user = "username";
   $ftp_pass = "gfhgfj236k";
   $conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
   $login = ftp_login($con, $ftp_user, $ftp_pass);
   echo ftp_set_option($conn,FTP_TIMEOUT_SEC,60);
   // close
   ftp_close($conn);
?>

Updated on: 30-Jul-2019

63 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements