<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.ftp-nb-fput.php',
    1 => 'ftp_nb_fput',
    2 => 'Escribe un fichero en un servidor FTP, y lo lee desde un fichero (no bloqueante)',
  ),
  'up' => 
  array (
    0 => 'ref.ftp.php',
    1 => 'Funciones de FTP',
  ),
  'prev' => 
  array (
    0 => 'function.ftp-nb-fget.php',
    1 => 'ftp_nb_fget',
  ),
  'next' => 
  array (
    0 => 'function.ftp-nb-get.php',
    1 => 'ftp_nb_get',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/ftp/functions/ftp-nb-fput.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ftp-nb-fput" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ftp_nb_fput</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ftp_nb_fput</span> &mdash; <span class="dc-title">Escribe un fichero en un servidor FTP, y lo lee desde un fichero (no bloqueante)</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ftp-nb-fput-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ftp_nb_fput</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<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>,<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_filename</code></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">$stream</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 class="initializer"> = <strong><code><a href="ftp.constants.php#constant.ftp-binary">FTP_BINARY</a></code></strong></span></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">$offset</code><span class="initializer"> = 0</span></span><br>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>ftp_nb_fput()</strong></span> escribe el fichero <code class="parameter">remote_filename</code>
   presente en la máquina local, en el servidor FTP <code class="parameter">ftp</code>.
  </p>
  <p class="para">
   La diferencia entre esta función y <span class="function"><a href="function.ftp-fput.php" class="function">ftp_fput()</a></span> es
   que esta función puede leer el fichero de manera asíncrona, para
   que su programa realice otras tareas mientras el fichero
   se descarga.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ftp-nb-fput-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">ftp</code></dt>
     <dd>
      <p class="para">Una instancia de <span class="classname"><a href="class.ftp-connection.php" class="classname">FTP\Connection</a></span>.</p>
     </dd>
    
    
     <dt><code class="parameter">remote_filename</code></dt>
     <dd>
      <p class="para">
       La ruta hacia el fichero remoto.
      </p>
     </dd>
    
    
     <dt><code class="parameter">stream</code></dt>
     <dd>
      <p class="para">
       Un puntero de fichero hacia un fichero local. La lectura se detiene al final
       del fichero.
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       El modo de transferencia. Debe ser <strong><code><a href="ftp.constants.php#constant.ftp-ascii">FTP_ASCII</a></code></strong> o
       <strong><code><a href="ftp.constants.php#constant.ftp-binary">FTP_BINARY</a></code></strong>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <p class="para">
       La posición en el fichero remoto desde la cual
       comenzará la descarga.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ftp-nb-fput-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Devuelve <strong><code><a href="ftp.constants.php#constant.ftp-failed">FTP_FAILED</a></code></strong>, <strong><code><a href="ftp.constants.php#constant.ftp-finished">FTP_FINISHED</a></code></strong>
   o <strong><code><a href="ftp.constants.php#constant.ftp-moredata">FTP_MOREDATA</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.ftp-nb-fput-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  El parámetro <code class="parameter">ftp</code> ahora espera una instancia de
  <span class="classname"><a href="class.ftp-connection.php" class="classname">FTP\Connection</a></span> ; anteriormente, se esperaba un <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
 </td>
</tr>

     <tr>
      <td>7.3.0</td>
      <td>
       El argumento <code class="parameter">mode</code> ahora es opcional. Anteriormente era obligatorio.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.ftp-nb-fput-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplo con <span class="function"><strong>ftp_nb_fput()</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">'index.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #DD0000">'r'</span><span style="color: #007700">);<br /><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: #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">// Inicia la subida<br /></span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">ftp_nb_fput</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">, </span><span style="color: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #0000BB">FTP_BINARY</span><span style="color: #007700">);<br />while (</span><span style="color: #0000BB">$ret </span><span style="color: #007700">== </span><span style="color: #0000BB">FTP_MOREDATA</span><span style="color: #007700">) {<br /><br />   </span><span style="color: #FF8000">// Realice lo que desee...<br />   </span><span style="color: #007700">echo </span><span style="color: #DD0000">"."</span><span style="color: #007700">;<br /><br />   </span><span style="color: #FF8000">// Continúa la subida...<br />   </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">ftp_nb_continue</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp</span><span style="color: #007700">);<br />}<br />if (</span><span style="color: #0000BB">$ret </span><span style="color: #007700">!= </span><span style="color: #0000BB">FTP_FINISHED</span><span style="color: #007700">) {<br />   echo </span><span style="color: #DD0000">"Ocurrió un problema durante la subida del fichero..."</span><span style="color: #007700">;<br />   exit(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</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-nb-fput-seealso">
  <h3 class="title">Ver también</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.ftp-nb-put.php" class="function" rel="rdfs-seeAlso">ftp_nb_put()</a> - Env&iacute;a un fichero a un servidor FTP (no bloqueante)</span></li>
    <li><span class="function"><a href="function.ftp-nb-continue.php" class="function" rel="rdfs-seeAlso">ftp_nb_continue()</a> - Reanuda la descarga de un fichero (no bloqueante)</span></li>
    <li><span class="function"><a href="function.ftp-put.php" class="function" rel="rdfs-seeAlso">ftp_put()</a> - Carga un fichero en un servidor FTP</span></li>
    <li><span class="function"><a href="function.ftp-fput.php" class="function" rel="rdfs-seeAlso">ftp_fput()</a> - Carga un fichero en un servidor FTP</span></li>
   </ul>
  </p>
 </div>

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