2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 07:05:15 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.ftp-nb-fput" xmlns="http://docbook.org/ns/docbook">
|
2005-01-16 05:09:23 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>ftp_nb_fput</refname>
|
|
|
|
<refpurpose>Stores a file from an open file to the FTP server (non-blocking)</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>int</type><methodname>ftp_nb_fput</methodname>
|
2021-01-01 19:48:16 +00:00
|
|
|
<methodparam><type>resource</type><parameter>ftp</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>remote_filename</parameter></methodparam>
|
|
|
|
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
2019-10-15 14:47:10 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>FTP_BINARY</constant></initializer></methodparam>
|
2021-01-01 19:48:16 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>0</initializer></methodparam>
|
2005-01-16 05:09:23 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
<function>ftp_nb_fput</function> uploads the data from a file pointer to
|
|
|
|
a remote file on the FTP server.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The difference between this function and the <function>ftp_fput</function>
|
|
|
|
is that this function uploads the file asynchronously, so your program can
|
|
|
|
perform other operations while the file is being uploaded.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2021-01-01 19:48:16 +00:00
|
|
|
<term><parameter>ftp</parameter></term>
|
2005-01-16 05:09:23 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The link identifier of the FTP connection.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2021-01-01 19:48:16 +00:00
|
|
|
<term><parameter>remote_filename</parameter></term>
|
2005-01-16 05:09:23 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The remote file path.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2021-01-01 19:48:16 +00:00
|
|
|
<term><parameter>stream</parameter></term>
|
2005-01-16 05:09:23 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
An open file pointer on the local file. Reading stops at end of file.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>mode</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The transfer mode. Must be either <constant>FTP_ASCII</constant> or
|
|
|
|
<constant>FTP_BINARY</constant>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2021-01-01 19:48:16 +00:00
|
|
|
<term><parameter>offset</parameter></term>
|
2005-01-16 05:09:23 +00:00
|
|
|
<listitem>
|
2011-02-10 14:36:22 +00:00
|
|
|
<para>The position in the remote file to start uploading to.</para>
|
2005-01-16 05:09:23 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns <constant>FTP_FAILED</constant> or <constant>FTP_FINISHED</constant>
|
|
|
|
or <constant>FTP_MOREDATA</constant>.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2018-06-13 16:03:25 +00:00
|
|
|
|
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>7.3.0</entry>
|
|
|
|
<entry>
|
|
|
|
The <parameter>mode</parameter> parameter is now optional. Formerly it
|
|
|
|
has been mandatory.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</refsect1>
|
|
|
|
|
2005-01-16 05:09:23 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>ftp_nb_fput</function> example</title>
|
|
|
|
<programlisting role="php">
|
2003-12-19 14:40:54 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$file = 'index.php';
|
|
|
|
|
|
|
|
$fp = fopen($file, 'r');
|
|
|
|
|
|
|
|
$conn_id = ftp_connect($ftp_server);
|
|
|
|
|
|
|
|
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
|
|
|
|
|
2020-04-27 06:53:54 +00:00
|
|
|
// Initiate the upload
|
2003-12-19 14:40:54 +00:00
|
|
|
$ret = ftp_nb_fput($conn_id, $file, $fp, FTP_BINARY);
|
|
|
|
while ($ret == FTP_MOREDATA) {
|
|
|
|
|
|
|
|
// Do whatever you want
|
|
|
|
echo ".";
|
|
|
|
|
|
|
|
// Continue upload...
|
|
|
|
$ret = ftp_nb_continue($conn_id);
|
|
|
|
}
|
|
|
|
if ($ret != FTP_FINISHED) {
|
|
|
|
echo "There was an error uploading the file...";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose($fp);
|
|
|
|
?>
|
|
|
|
]]>
|
2005-01-16 05:09:23 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>ftp_nb_put</function></member>
|
|
|
|
<member><function>ftp_nb_continue</function></member>
|
|
|
|
<member><function>ftp_put</function></member>
|
|
|
|
<member><function>ftp_fput</function></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-10-14 16:18:32 +00:00
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-10-14 16:18:32 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|