<?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-chmod.php',
    1 => 'ftp_chmod',
    2 => 'Modifie les droits d\'un fichier via FTP',
  ),
  'up' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'Fonctions FTP',
  ),
  'prev' => 
  array (
    0 => 'function.ftp-chdir.php',
    1 => 'ftp_chdir',
  ),
  'next' => 
  array (
    0 => 'function.ftp-close.php',
    1 => 'ftp_close',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/ftp/functions/ftp-chmod.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ftp-chmod" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ftp_chmod</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ftp_chmod</span> &mdash; <span class="dc-title">Modifie les droits d&#039;un fichier via FTP</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ftp-chmod-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ftp_chmod</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">$permissions</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment"> 
   <span class="function"><strong>ftp_chmod()</strong></span> modifie les droits d&#039;accès au fichier
   <code class="parameter">filename</code> sur le serveur FTP 
   <code class="parameter">ftp</code>, en lui attribuant les droits de
   <code class="parameter">permissions</code>, spécifiés sous la forme d&#039;un entier
   en base octale.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ftp-chmod-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">permissions</code></dt>
     <dd>
      <p class="para">
       La nouvelle permission, donnée en tant que valeur <em>octale</em>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       Le fichier distant.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ftp-chmod-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne les nouvelles permissions du fichier 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-chmod-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-chmod-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_chmod()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= </span><span style="color: #DD0000">'public_html/index.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Mise en place d'une connexion basique<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: #0000BB">$ftp_server</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Identification avec un nom d'utilisateur et un mot de passe<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: #0000BB">$ftp_user_name</span><span style="color: #007700">, </span><span style="color: #0000BB">$ftp_user_pass</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Tentative de modification des permissions du fichier $file en 644<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">ftp_chmod</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">, </span><span style="color: #0000BB">0644</span><span style="color: #007700">, </span><span style="color: #0000BB">$file</span><span style="color: #007700">) !== </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"Les permissions du fichier </span><span style="color: #0000BB">$file</span><span style="color: #DD0000"> ont été modifiées avec succès en 644\n"</span><span style="color: #007700">;<br />} else {<br /> echo </span><span style="color: #DD0000">"Impossible de modifier les permissions du fichier </span><span style="color: #0000BB">$file</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">// Fermeture de la connexion<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 /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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

 <div class="refsect1 seealso" id="refsect1-function.ftp-chmod-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.chmod.php" class="function" rel="rdfs-seeAlso">chmod()</a> - Change le mode du fichier</span></li>
   </ul>
  </p>
 </div>

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