Documentation added / corrected.

Goba

> > > yesterday I did several commits to the FTP extension. Due to the fact
that
> > > I do not know how I can document the stuff myself and right now am
lacking
> > > the time here is a brief instruction:
> > >
> > > Stefan Esser
> > >
> >
> --------------------------------------------------------------------------
> > -
> > > 5 new constants
> > > ---------------
> > >
> > > FTP_AUTOSEEK     new option for get/set_option: when enabled (which is
> > default)
> > >                  get/put requests with a resumepos/startpos will first
> > seek
> > >                  to the wanted position within the stream
> > >
> > > FTP_AUTORESUME   automaticly determine resumepos/startpos for get/put
> > request
> > >                  (does only work if AUTOSEEK is enabled)
> > >
> > > FTP_FAILED       asynchronous transfer has failed
> > > FTP_FINISHED     asynchronous transfer has finished
> > > FTP_MOREDATA     asynchronous transfer is still active
> > >
> > > New optional 5th parameter
> > > --------------------------
> > >
> > > Added optional "startpos" to ftp_put/ftp_fput (works like in the async
> > examples)
> > > Added optional "resumepos" to ftp_get/ftp_fget (works like in the
async
> > examples)
> > >
> > > New asynchronous FTP functions
> > > ------------------------------
> > >
> > > int ftp_async_get(resource ftp_stream, string local_file, string
> > remote_file, int mode[, int resumepos])
> > > int ftp_async_fget(resource ftp_stream, resource fp, string
remote_file,
> > int mode[, int resumepos])
> > > int ftp_async_put(resource ftp_stream, string remote_file, string
> > local_file, int mode[, int startpos])
> > > int ftp_async_fput(resource ftp_stream, string remote_file, resource
fp,
> > int mode[, int startpos])
> > > int ftp_async_continue(resource ftp_stream)
> > >
> > >
> > > Example (Downloading a file):
> > > -----------------------------
> > >
> > > ...
> > > // Initate the Download
> > > $ret = ftp_async_get ($my_connection, "test", "README", FTP_BINARY);
> > > while ($ret == FTP_MOREDATA) {
> > >
> > >    // Do whatever you want
> > >    echo ".";
> > >
> > >    // Continue downloading...
> > >    $ret = ftp_async_continue ($my_connection);
> > > }
> > > if ($ret != FTP_FINISHED) {
> > >    echo "There was an error downloading the file...";
> > >    exit(1);
> > > }
> > > ...
> > >
> > > Example (Uploading a file):
> > > -----------------------------
> > >
> > > ...
> > > // Initiate the Upload
> > > $ret = ftp_async_put ($my_connection, "test.remote", "test.local",
> > FTP_BINARY);
> > > while ($ret == FTP_MOREDATA) {
> > >
> > >    // Do whatever you want
> > >    echo ".";
> > >
> > >    // Continue uploading...
> > >    $ret = ftp_async_continue ($my_connection);
> > > }
> > > if ($ret != FTP_FINISHED) {
> > >    echo "There was an error uploading the file...";
> > >    exit(1);
> > > }
> > > ...
> > >
> > >
> > > Example (Resume downloading a file):
> > > ------------------------------------
> > >
> > > ...
> > > // Initate
> > > $ret = ftp_async_get ($my_connection, "test", "README", FTP_BINARY,
> > >                       filesize("test"));
> > > // OR: $ret = ftp_async_get ($my_connection, "test", "README",
> > > //                           FTP_BINARY, FTP_AUTORESUME);
> > > while ($ret == FTP_MOREDATA) {
> > >
> > >    // Do whatever you want
> > >    echo ".";
> > >
> > >    // Continue downloading...
> > >    $ret = ftp_async_continue ($my_connection);
> > > }
> > > if ($ret != FTP_FINISHED) {
> > >    echo "There was an error downloading the file...";
> > >    exit(1);
> > > }
> > > ...
> > >
> > > Example (Resume uploading a file):
> > > ----------------------------------
> > >
> > > ...
> > > // Initiate
> > > $ret = ftp_async_put ($my_connection, "test.remote", "test.local",
> > >                       FTP_BINARY, ftp_size("test.remote"));
> > > // OR: $ret = ftp_async_put ($my_connection, "test.remote",
"test.local",
> > > //                           FTP_BINARY, FTP_AUTORESUME);
> > >
> > > while ($ret == FTP_MOREDATA) {
> > >
> > >    // Do whatever you want
> > >    echo ".";
> > >
> > >    // Continue uploading...
> > >    $ret = ftp_async_continue ($my_connection);
> > > }
> > > if ($ret != FTP_FINISHED) {
> > >    echo "There was an error uploading the file...";
> > >    exit(1);
> > > }
> > > ...
> > >
> > > Example (Resume downloading at position 100 to a new file):
> > > -----------------------------------------------------------
> > > ...
> > > // Disable Autoseek
> > > ftp_set_option ($my_connection, FTP_AUTOSEEK, FALSE);
> > >
> > > // Initiate
> > > $ret = ftp_async_get ($my_connection, "newfile", "README", FTP_BINARY,
> > 100);
> > > while ($ret == FTP_MOREDATA) {
> > >
> > >    ...
> > >
> > >    // Continue downloading...
> > >    $ret = ftp_async_continue ($my_connection);
> > > }
> > > ...
> > >
> > > newfile is now 100 bytes smaller than README on the ftp because
> > > we started reading at offset 100. If we have not have disabled
> > > AUTOSEEK the first 100 bytes of newfile will be '\0'...
> > >
> > >
> > >
> > > --
> > > PHP Development Mailing List <http://www.php.net/>
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > > --
> > > PHP Documentation Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
>
> --------------------------------------------------------------------------
-
>  Did I help you?   http://www.derickrethans.nl/link.php?url=giftlist
>  Frequent ranting: http://www.derickrethans.nl/
> --------------------------------------------------------------------------
-
>                  PHP: Scripting the Web - [EMAIL PROTECTED]
>                     All your branches are belong to me!
>                 SRM: Script Running Machine - www.vl-srm.net
> --------------------------------------------------------------------------
-
>
>
> --
> PHP Documentation Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to