FTP_PASV(3) 1 FTP_PASV(3)ftp_pasv - Turns passive mode on or offSYNOPSIS
bool ftp_pasv (resource $ftp_stream, bool $pasv)
DESCRIPTION ftp_pasv(3) turns on or off passive mode. In passive mode, data connections are initiated by the client, rather than by the server. It may
be needed if the client is behind firewall.
Please note that ftp_pasv(3) can only be called after a successfull login or otherwise it will fail.
PARAMETERS
o $ftp_stream
- The link identifier of the FTP connection.
o $pasv
- If TRUE, the passive mode is turned on, else it's turned off.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
ftp_pasv(3) example
<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// turn passive mode on
ftp_pasv($conn_id, true);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file
";
} else {
echo "There was a problem while uploading $file
";
}
// close the connection
ftp_close($conn_id);
?>
PHP Documentation Group FTP_PASV(3)
Check Out this Related Man Page
FTP_FPUT(3) 1 FTP_FPUT(3)ftp_fput - Uploads from an open file to the FTP serverSYNOPSIS
bool ftp_fput (resource $ftp_stream, string $remote_file, resource $handle, int $mode, [int $startpos])
DESCRIPTION ftp_fput(3) uploads the data from a file pointer to a remote file on the FTP server.
PARAMETERS
o $ftp_stream
- The link identifier of the FTP connection.
o $remote_file
- The remote file path.
o $handle
- An open file pointer on the local file. Reading stops at end of file.
o $mode
- The transfer mode. Must be either FTP_ASCII or FTP_BINARY.
o $startpos
-The position in the remote file to start uploading to.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
ftp_fput(3) example
<?php
// open some file for reading
$file = 'somefile.txt';
$fp = fopen($file, 'r');
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to upload $file
if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
echo "Successfully uploaded $file
";
} else {
echo "There was a problem while uploading $file
";
}
// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);
?>
SEE ALSO ftp_put(3), ftp_nb_fput(3), ftp_nb_put(3).
PHP Documentation Group FTP_FPUT(3)
I have a ftp server up , however when I upload a file from my desktop to the server I get this message:
ftp> get uploadtest.txt
Local: uploadtest.txt Remote: uploadtest.txt
227 passive Mode ( 192,168,0,1,190,75)
550 Failed to open file
ftp> (3 Replies)
Hi,
I'm getting the following error while trying to use the ftp command.
----------------
331 Password required for prodofsa.
Password:
230 User prodofsa logged in.
ftp>
ftp>
ftp>
ftp> ls
200 PORT command successful.
425 Can't build data connection: Connection timed out.
ftp>... (10 Replies)
Hi guys,
I have a problem where by I need to remane a file by moving it to another location. For instance I have a file called
change.txt
changeA.txt
changeB.txt
and I need to change the name to
change_a1.txt
changeA_a2.txt
changeB_a3.txt
I need a sed regular expression that changes... (3 Replies)
Hi All,
I have a problem when uploading txt file from windows to Unix server.
I got 533 I/O error. I am using .bat file and it works for other batches but with this particular batch it doesn't work.
thanks guys for helping in advance. (2 Replies)
Hi,
I have to upload a file test_201105281100.txt to a ftp location.
The files will be created on hourly basis like test_201105281100.txt, test_201105281200.txt & so on.
After a file is uploaded successfully, I need to rename the file as test_201105281100.success & if it is not uploaded... (11 Replies)
I am using vsftp but I can't login with passive mode. I can only login with active mode. I can login with both mode when service of iptables is stop.
In active mode : 20,21 must be open from server site. 1023 and over must be open at client site.
In passive mode : only 21,1023 and over must be... (1 Reply)