<?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-put.php',
    1 => 'ftp_put',
    2 => 'Trasferisce un file al server FTP',
  ),
  'up' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'FTP Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.ftp-pasv.php',
    1 => 'ftp_pasv',
  ),
  'next' => 
  array (
    0 => 'function.ftp-pwd.php',
    1 => 'ftp_pwd',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/ftp/functions/ftp-put.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ftp-put" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">ftp_put</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ftp_put</span> &mdash; <span class="dc-title">Trasferisce un file al server FTP</span></p>

   </div>
   <div class="refsect1 unknown-1036" id="refsect1-function.ftp-put-unknown-1036">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>ftp_put</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$ftp_stream</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$remote_file</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$local_file</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$startpos</code><span class="initializer"> = ?</span></span><br>): <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_put()</strong></span> salva <code class="parameter">local_file</code>
     sul server FTP come <code class="parameter">remote_file</code>. Il modo di trasferimento
     <code class="parameter">mode</code> specificato deve essere
     <strong><code><a href="ftp.constants.php#constant.ftp-ascii">FTP_ASCII</a></code></strong> oppure <strong><code><a href="ftp.constants.php#constant.ftp-binary">FTP_BINARY</a></code></strong>.
    </p>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <p class="para">
      Il parametro <code class="parameter">startpos</code> e&#039; stato aggiunto nella release PHP 4.3.0.
     </p>
    </p></blockquote>
    <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>
    <p class="para">
     <div class="example" id="example-1">
      <p><strong>Example #1 Esempio di funzione <span class="function"><strong>ftp_put()</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">'somefile.txt'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$remote_file </span><span style="color: #007700">= </span><span style="color: #DD0000">'readme.txt'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// stabilisce la connessione<br /></span><span style="color: #0000BB">$conn_id </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">// si collega con username and password<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">$conn_id</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">// trasferisce un file al server<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">ftp_put</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">, </span><span style="color: #0000BB">$remote_file</span><span style="color: #007700">, </span><span style="color: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #0000BB">FTP_ASCII</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"</span><span style="color: #0000BB">$file</span><span style="color: #DD0000"> trasferito correttamente\n"</span><span style="color: #007700">;<br />} else {<br /> echo </span><span style="color: #DD0000">"Si e' verificato un problema durante il trasferimento di </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">// chiude la connessione<br /></span><span style="color: #0000BB">ftp_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
    <p class="para">
     Vedere anche <span class="function"><a href="function.ftp-fput.php" class="function">ftp_fput()</a></span>, <span class="function"><a href="function.ftp-nb-fput.php" class="function">ftp_nb_fput()</a></span>,
     e <span class="function"><a href="function.ftp-nb-put.php" class="function">ftp_nb_put()</a></span>.
    </p>
   </div>

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