Source of: /manual/en/function.ftp-set-option.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.ftp.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.ftp-set-option.php',
1 => 'ftp_set_option',
),
'up' =>
array (
0 => 'ref.ftp.php',
1 => 'FTP Functions',
),
'prev' =>
array (
0 => 'function.ftp-rmdir.php',
1 => 'ftp_rmdir',
),
'next' =>
array (
0 => 'function.ftp-site.php',
1 => 'ftp_site',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.ftp-set-option" class="refentry">
<div class="refnamediv">
<h1 class="refname">ftp_set_option</h1>
<p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">ftp_set_option</span> — <span class="dc-title">Set miscellaneous runtime FTP options</span></p>
</div>
<a name="function.ftp-set-option.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">bool</span> <span class="methodname"><b>ftp_set_option</b></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$ftp_stream</tt></span>
, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$option</tt></span>
, <span class="methodparam"><span class="type"><a href="language.pseudo-types.php#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$value</tt></span>
)</div>
<p class="para rdfs-comment">
This function controls various runtime options for the specified FTP
stream.
</p>
</div>
<a name="function.ftp-set-option.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">ftp_stream</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The link identifier of the FTP connection.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">option</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Currently, the following options are supported:
</p><table class="doctable table">
<caption><b>Supported runtime FTP options</b></caption>
<tbody valign="middle" class="tbody">
<tr valign="middle">
<td align="left"><b><tt class="constant">FTP_TIMEOUT_SEC</tt></b></td>
<td align="left">
Changes the timeout in seconds used for all network related
functions. <i><tt class="parameter">value</tt></i>
must be an integer that
is greater than 0. The default timeout is 90 seconds.
</td>
</tr>
<tr valign="middle">
<td align="left"><b><tt class="constant">FTP_AUTOSEEK</tt></b></td>
<td align="left">
When enabled, GET or PUT requests with a
<i><tt class="parameter">resumepos</tt></i>
or <i><tt class="parameter">startpos</tt></i>
parameter will first seek to the requested position within the file.
This is enabled by default.
</td>
</tr>
</tbody>
</table>
<p>
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">value</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
This parameter depends on which <i><tt class="parameter">option</tt></i>
is chosen
to be altered.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.ftp-set-option.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <b><tt class="constant">TRUE</tt></b> if the option could be set; <b><tt class="constant">FALSE</tt></b> if not. A warning
message will be thrown if the <i><tt class="parameter">option</tt></i>
is not
supported or the passed <i><tt class="parameter">value</tt></i>
doesn't match the
expected value for the given <i><tt class="parameter">option</tt></i>
.
</p>
</div>
<a name="function.ftp-set-option.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>ftp_set_option()</b> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Set the network timeout to 10 seconds<br /></span><span style="color: #0000BB">ftp_set_option</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">, </span><span style="color: #0000BB">FTP_TIMEOUT_SEC</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.ftp-set-option.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.ftp-get-option.php" class="function" rel="rdfs-seeAlso">ftp_get_option()</a> - Retrieves various runtime behaviours of the current FTP stream</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>