<HTML ><HEAD ><TITLE >ftp_nb_put</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="FTP functions" HREF="ref.ftp.html"><LINK REL="PREVIOUS" TITLE="ftp_nb_get" HREF="function.ftp-nb-get.html"><LINK REL="NEXT" TITLE="ftp_nlist" HREF="function.ftp-nlist.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ftp-nb-get.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ftp-nlist.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ftp-nb-put" ></A >ftp_nb_put</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN28788" ></A ><P > (PHP 4 >= 4.3.0)</P >ftp_nb_put -- Stores a file on the FTP server (non-blocking)</DIV ><DIV CLASS="refsect1" ><A NAME="AEN28791" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >ftp_nb_put</B > ( resource ftp_stream, string remote_file, string local_file, int mode [, int startpos])<BR ></BR ><P > <B CLASS="function" >ftp_nb_put()</B > stores <TT CLASS="parameter" ><I >local_file</I ></TT > on the FTP server, as <TT CLASS="parameter" ><I >remote_file</I ></TT >. The transfer <TT CLASS="parameter" ><I >mode</I ></TT > specified must be either <TT CLASS="constant" ><B >FTP_ASCII</B ></TT > or <TT CLASS="constant" ><B >FTP_BINARY</B ></TT >. The difference between this function and the <A HREF="function.ftp-put.html" ><B CLASS="function" >ftp_put()</B ></A > is that this function uploads the file asynchronously, so your program can perform other operations while the file is being downloaded. </P ><P > Returns <TT CLASS="constant" ><B >TRUE</B ></TT > on success or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN28823" ></A ><P ><B >Example 1. <B CLASS="function" >ftp_nb_put()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >// Initiate the Upload $ret = ftp_nb_put($my_connection, "test.remote", "test.local", FTP_BINARY); while ($ret == FTP_MOREDATA) { // Do whatever you want echo "."; // Continue uploading... $ret = ftp_nb_continue ($my_connection); } if ($ret != FTP_FINISHED) { echo "There was an error uploading the file..."; exit(1); }</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN28827" ></A ><P ><B >Example 2. Resuming an upload with <B CLASS="function" >ftp_nb_put()</B ></B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >// Initiate $ret = ftp_nb_put ($my_connection, "test.remote", "test.local", FTP_BINARY, ftp_size("test.remote")); // OR: $ret = ftp_nb_put ($my_connection, "test.remote", "test.local", // FTP_BINARY, FTP_AUTORESUME); while ($ret == FTP_MOREDATA) { // Do whatever you want echo "."; // Continue uploading... $ret = ftp_nb_continue ($my_connection); } if ($ret != FTP_FINISHED) { echo "There was an error uploading the file..."; exit(1); }</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.ftp-nb-fput.html" ><B CLASS="function" >ftp_nb_fput()</B ></A >, <A HREF="function.ftp-nb-continue.html" ><B CLASS="function" >ftp_nb_continue()</B ></A >, <A HREF="function.ftp-put.html" ><B CLASS="function" >ftp_put()</B ></A > and <A HREF="function.ftp-fput.html" ><B CLASS="function" >ftp_fput()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ftp-nb-get.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ftp-nlist.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ftp_nb_get</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ftp.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ftp_nlist</TD ></TR ></TABLE ></DIV ></BODY ></HTML >