pollita         Fri Sep 19 00:51:06 2003 EDT

  Added files:                 
    /phpdoc/en/reference/ftp/functions  ftp-alloc.xml 
  Log:
  Initial Revision
  

Index: phpdoc/en/reference/ftp/functions/ftp-alloc.xml
+++ phpdoc/en/reference/ftp/functions/ftp-alloc.xml
<?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', '[EMAIL PROTECTED]');

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
-->

Reply via email to