<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = 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 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.ftp-alloc.php',
    1 => 'ftp_alloc',
    2 => 'Allocates space for a file to be uploaded',
  ),
  'up' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'FTP Funzioni',
  ),
  'prev' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'FTP Funzioni',
  ),
  'next' => 
  array (
    0 => 'function.ftp-append.php',
    1 => 'ftp_append',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ftp/functions/ftp-alloc.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ftp-alloc" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ftp_alloc</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ftp_alloc</span> &mdash; <span class="dc-title">Allocates space for a file to be uploaded</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ftp-alloc-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ftp_alloc</strong></span>(<span class="methodparam"><span class="type"><a href="class.ftp-connection.php" class="type FTP\Connection">FTP\Connection</a></span> <code class="parameter">$ftp</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$size</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter reference">&$response</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Sends an <code class="literal">ALLO</code> command to the remote FTP server to 
   allocate space for a file to be uploaded.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Many FTP servers do not support this command.  These servers may return a failure 
    code (<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>) indicating the command is not supported or a success code (<strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>)
    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.
   </p>
  </p></blockquote>
  <p class="para">
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ftp-alloc-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">ftp</code></dt>
     <dd>
       <p class="para">An <span class="classname"><a href="class.ftp-connection.php" class="classname">FTP\Connection</a></span> instance.</p>
     </dd>
    
    
     <dt><code class="parameter">size</code></dt>
     <dd>
      <p class="para">
       The number of bytes to allocate.
      </p>
     </dd>
    
    
     <dt><code class="parameter">response</code></dt>
     <dd>
      <p class="para">
       A textual representation of the servers response will be returned by 
       reference in <code class="parameter">response</code> if a variable is provided.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ftp-alloc-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.ftp-alloc-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versione</th>
      <th>Descrizione</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  The <code class="parameter">ftp</code> parameter expects an <span class="classname"><a href="class.ftp-connection.php" class="classname">FTP\Connection</a></span>
  instance now; previously, a <a href="language.types.resource.php" class="link">resource</a> was expected.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>

 
 <div class="refsect1 examples" id="refsect1-function.ftp-alloc-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>ftp_alloc()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$file </span><span style="color: #007700">= </span><span style="color: #DD0000">"/home/user/myfile"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// connect to the server<br /></span><span style="color: #0000BB">$ftp </span><span style="color: #007700">= </span><span style="color: #0000BB">ftp_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'ftp.example.com'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$login_result </span><span style="color: #007700">= </span><span style="color: #0000BB">ftp_login</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">, </span><span style="color: #DD0000">'anonymous'</span><span style="color: #007700">, </span><span style="color: #DD0000">'user@example.com'</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">ftp_alloc</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">, </span><span style="color: #0000BB">filesize</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">), </span><span style="color: #0000BB">$result</span><span style="color: #007700">)) {<br />  echo </span><span style="color: #DD0000">"Space successfully allocated on server.  Sending </span><span style="color: #0000BB">$file</span><span style="color: #DD0000">.\n"</span><span style="color: #007700">;<br />  </span><span style="color: #0000BB">ftp_put</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">, </span><span style="color: #DD0000">'/incoming/myfile'</span><span style="color: #007700">, </span><span style="color: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #0000BB">FTP_BINARY</span><span style="color: #007700">);<br />} else {<br />  echo </span><span style="color: #DD0000">"Unable to allocate space on server.  Server said: </span><span style="color: #0000BB">$result</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">ftp_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.ftp-alloc-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.ftp-put.php" class="function" rel="rdfs-seeAlso">ftp_put()</a> - Trasferisce un file al server FTP</span></li>
    <li><span class="function"><a href="function.ftp-fput.php" class="function" rel="rdfs-seeAlso">ftp_fput()</a> - Carica un file aperto sul server FTP</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>