Initial Revision

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@140609 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sara Golemon 2003-09-19 04:51:06 +00:00
parent fb512b8f7e
commit eefe08d5ae

View file

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.ftp-alloc">
<refnamediv>
<refname>ftp_alloc</refname>
<refpurpose>Allocates space for a file to be uploaded.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_alloc</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>int</type><parameter>filesize</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>&amp;result</parameter></methodparam>
</methodsynopsis>
<simpara>
Sends an ALLO command to the remote FTP server to allocate <parameter>filesize</parameter>
bytes of space. Returns &true; on success, or &false; on failure.
</simpara>
<note>
<simpara>
Many FTP servers do not support this command. These servers may return a failure
code (&false;) indicating the command is not supported or a success code (&true;)
to indicate that pre-allocation is not necessary and the client should continue
as though the operation were successful. Because of this, it may be best to reserve
this function for servers which explicitly require preallocation.
</simpara>
</note>
<simpara>
A textual representation of the servers response will be returned by reference in
<parameter>result</parameter> is a variable is provided.
</simpara>
<para>
<example>
<title><function>ftp_alloc</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = "/home/user/myfile";
/* connect to the server */
$conn_id = ftp_connect('ftp.example.com);
$login_result = ftp_login($conn_id, 'anonymous', 'user@example.com');
if (ftp_alloc($conn_id, filesize($file), $result)) {
echo "Space successfully allocated on server. Sending $file.\n";
ftp_put($conn_id, '/incomming/myfile', $file, FTP_BINARY);
} else {
echo "Unable to allocate space on server. Server said: $result\n";
}
ftp_close($conn_id);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also:
<function>ftp_put</function>, and
<function>ftp_fput</function>.
</para>
</refsect1>
</refentry>
<!-- 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
sgml-default-dtd-file:"../../../../manual.ced"
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
-->