PHP ftp_set_option() function

Definition and Usage

The ftp_set_option() function sets various FTP runtime options.

Syntax

ftp_set_option(ftp_connection,option,value)
Parameters Description
ftp_connection Required. Specifies the FTP connection to be used (identifier of the FTP connection).
option

Required. Specifies the runtime option to be set. Possible values:

  • FTP_TIMEOUT_SEC
  • FTP_AUTOSEEK

Detailed information can be found in the following description.

value Required. Set the value of the option parameter.

Description

The FTP_TIMEOUT_SEC option changes the timeout time for network transmission. Parameter value It must be an integer greater than 0. The default timeout is 90 seconds.

When the FTP_AUTOSEEK option is enabled, GET or PUT requests with resumepos or startpos parameters will first seek to the specified position in the file. This option is enabled by default.

实例

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_set_option($conn,FTP_TIMEOUT_SEC,120);
ftp_close($conn);
?>