Added example, tagged constants as constants, some indentation.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@31732 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ron Chmara 2000-09-02 04:11:38 +00:00
parent c45f66fd67
commit a16e219d25

View file

@ -8,10 +8,43 @@
<para>
The following constants are defined when using the FTP module:
<constant>FTP_ASCII</constant> and <constant>FTP_BINARY</constant>.
</para>
<para>
<example>
<title><function>ftp</function> example</title>
<programlisting>
&lt;?php
// set up basic connection
$conn_id = ftp_connect("$ftp_server");
FTP_ASCII, and
FTP_BINARY.</para>
// login with username and password
$login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass");
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user";
}
// upload the file
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY);
// check upload status
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_quit($conn_id);
?>
</programlisting>
</example>
</partintro>
<refentry id="function.ftp-connect">
@ -274,7 +307,9 @@
<function>ftp_get</function> retrieves <parameter>remote_file</parameter>
from the FTP server, and saves it to <parameter>local_file</parameter>
locally. The transfer <parameter>mode</parameter> specified must
be either FTP_ASCII or FTP_BINARY.</para>
be either <constant>FTP_ASCII</constant> or
<constant>FTP_BINARY</constant>.
</para>
</refsect1>
</refentry>
@ -326,8 +361,9 @@
<para>
<function>ftp_put</function> stores <parameter>local_file</parameter>
on the FTP server, as <parameter>remote_file</parameter>. The transfer
<parameter>mode</parameter> specified must be either FTP_ASCII or
FTP_BINARY.</para>
<parameter>mode</parameter> specified must be either
<constant>FTP_ASCII</constant> or <constant>FTP_BINARY</constant>.
</para>
</refsect1>
</refentry>
@ -353,8 +389,9 @@
<function>ftp_fput</function> uploads the data from the file pointer
<parameter>fp</parameter> until end of file. The results are stored
in <parameter>remote_file</parameter> on the FTP server. The transfer
<parameter>mode</parameter> specified must be either FTP_ASCII or
FTP_BINARY.</para>
<parameter>mode</parameter> specified must be either
<constant>FTP_ASCII</constant> or <constant>FTP_BINARY</constant>
</para>
</refsect1>
</refentry>
@ -430,7 +467,9 @@
Returns true on success, false on error.</para>
<para>
<function>ftp_rename</function> renames the file specified
by <parameter>from</parameter> to the new name <parameter>to</parameter></para>
by <parameter>from</parameter> to the new name
<parameter>to</parameter>
</para>
</refsect1>
</refentry>
@ -452,7 +491,8 @@
Returns true on success, false on error.</para>
<para>
<function>ftp_delete</function> deletes the file specified by
<parameter>path</parameter> from the FTP server.</para>
<parameter>path</parameter> from the FTP server.
</para>
</refsect1>
</refentry>
@ -495,7 +535,8 @@
</funcprototype>
</funcsynopsis>
<para>
<function>ftp_connect</function> closes <parameter>ftp_stream</parameter>.</para>
<function>ftp_connect</function> closes <parameter>ftp_stream</parameter>.
</para>
</refsect1>
</refentry>