ftp_nb_put

ftp_nb_put -- Slaat een bestand op de FTP server op (non-blocking)

Beschrijving

bool ftp_nb_put ( resource ftp_stream, string remote_file, string local_file, int mode [, int startpos])

ftp_nb_put( ) slaat local_file op de FTP server op als remote_file . De overdracht mode moet of FTP_ASCII of FTP_BINARY . Het verschil met ftp_fput( ) is dat deze functie het bestand asynchroon upload , zodat je andere dingen kan doen in je programma terwijl het bestand wordt geupload .

Geeft TRUE terug bij succes , FALSE indien er een fout is opgetreden .

Voorbeeld 1 . ftp_nb_put( ) voorbeeld

 
/

 
/

 
Initialiseer

 
de

 
upload

 
$ret

 
=

 
ftp_nb_put(

 
$my_connection

 
,

 
"test.remote"

 
,

 
"test.local"

 
,

 
FTP_BINARY)

 
;

 
while

 
($ret

 
==

 
FTP_MOREDATA

 
)

 
{

 
/

 
/

 
Doe

 
wat

 
je

 
ook

 
maar

 
wil

 
doen

 
echo

 
"

 
."

 
;

 
/

 
/

 
Ga

 
door

 
met

 
downloaden..

 
.

 
$ret

 
=

 
ftp_nb_continue

 
($my_connection)

 
;

 
}

 
if

 
($ret

 
!=

 
FTP_FINISHED

 
)

 
{

 
echo

 
"Er

 
was

 
een

 
fout

 
met

 
het

 
uploaden

 
van

 
het

 
bestand..

 
."

 
;

 
exit(1)

 
;

 
}



Voorbeeld 2 . Een download met ftp_nb_put( ) afmaken

 
/

 
/

 
Initialiseer

 
$ret

 
=

 
ftp_nb_put

 
(

 
$my_connection

 
,

 
"test.remote"

 
,

 
"test.local"

 
,

 
FTP_BINARY

 
,

 
ftp_size("test.remote"))

 
;

 
/

 
/

 
OF

 
:

 
$ret

 
=

 
ftp_nb_put

 
($my_connection

 
,

 
"test.remote"

 
,

 
"test.local"

 
,

 
/

 
/

 
FTP_BINARY

 
,

 
FTP_AUTORESUME)

 
;

 
while

 
($ret

 
==

 
FTP_MOREDATA

 
)

 
{

 
/

 
/Doe

 
wat

 
je

 
ook

 
maar

 
wil

 
echo

 
"

 
."

 
;

 
/

 
/

 
Ga

 
door

 
met

 
downloaden..

 
.

 
$ret

 
=

 
ftp_nb_continue

 
($my_connection)

 
;

 
}

 
if

 
($ret

 
!=

 
FTP_FINISHED

 
)

 
{

 
echo

 
"Er

 
was

 
een

 
fout

 
met

 
het

 
uploaden

 
van

 
het

 
bestand..

 
."

 
;

 
exit(1)

 
;

 
}





Zie ook ftp_nb_fput( ) , ftp_nb_continue( ) , ftp_put( ) en ftp_fput( ) .