<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.ftp-alloc.php',
    1 => 'ftp_alloc',
    2 => 'Alloue de l\'espace pour un t&eacute;l&eacute;chargement de fichier',
  ),
  'up' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'Fonctions FTP',
  ),
  'prev' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'Fonctions FTP',
  ),
  'next' => 
  array (
    0 => 'function.ftp-append.php',
    1 => 'ftp_append',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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">Alloue de l&#039;espace pour un téléchargement de fichier</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ftp-alloc-description">
  <h3 class="title">Description</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">
   <span class="function"><strong>ftp_alloc()</strong></span> envoie la commande FTP <code class="literal">ALLO</code>
   pour allouer un espace sur le serveur FTP de <code class="parameter">size</code>
   octets.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    De nombreux serveurs FTP ne supportent pas cette commande. Ces
    serveurs peuvent retourner un code d&#039;erreur (<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>) qui indique
    que la commande n&#039;est pas supportée, ou (<strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>) pour dire que la
    préallocation n&#039;est pas nécessaire : le client continue alors ses 
    opérations de la même façon. À cause de cela, il est préférable
    de n&#039;utiliser cette fonction qu&#039;avec les serveurs qui requièrent
    spécifiquement cette fonction.
   </p>
  </p></blockquote>
  <p class="para">
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ftp-alloc-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">ftp</code></dt>
     <dd>
      <p class="para">Une instance de <span class="classname"><a href="class.ftp-connection.php" class="classname">FTP\Connection</a></span>.</p>
     </dd>
    
    
     <dt><code class="parameter">size</code></dt>
     <dd>
      <p class="para">
       Le nombre d&#039;octets à allouer.
      </p>
     </dd>
    
    
     <dt><code class="parameter">response</code></dt>
     <dd>
      <p class="para">
       Une représentation textuelle de la réponse du serveur qui sera retournée
       par référence dans <code class="parameter">response</code> si une variable est fournie.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ftp-alloc-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Cette fonction retourne <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en cas de succès ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.ftp-alloc-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  La paramètre <code class="parameter">ftp</code> attend désormais une instance de
  <span class="classname"><a href="class.ftp-connection.php" class="classname">FTP\Connection</a></span> ; auparavant, une <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> était attendu.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>

 
 <div class="refsect1 examples" id="refsect1-function.ftp-alloc-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>ftp_alloc()</strong></span></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">// Connexion au serveur<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">"Espace alloué avec succès sur le serveur. Envoi de </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">"Impossible d'allouer l'espace sur le serveur. Réponse du serveur : </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">Voir aussi</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> - Charge un fichier sur un serveur FTP</span></li>
    <li><span class="function"><a href="function.ftp-fput.php" class="function" rel="rdfs-seeAlso">ftp_fput()</a> - T&eacute;l&eacute;verse un fichier sur un serveur FTP</span></li>
   </ul>
  </p>
 </div>

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