![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_pasv() function in PHP
The ftp_pasv() function turns the passive mode on or off.
Syntax
ftp_pasv(con, pasv)
Parameters
con − The FTP connection
pasv − Specifies the passive mode. The following are the possible values −
TRUE (passive mode on)
FALSE (passive mode off)
Return
The ftp_pasv() function returns TRUE on success or FALSE on failure
Example
The following is an example −
<?php $ftp_server="192.168.0.4"; $ftp_user="tim"; $ftp_pass="wthbn#@121"; $con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); $login = ftp_login($con, $ftp_user, $ftp_pass); ftp_pasv($con, true); $local_file = "localfile.txt"; $my_serverfile = "serverfile.txt"; if (ftp_put($ftp_conn, $my_serverfile, $local_file, FTP_ASCII)){ echo "File uploaded!"; } else { echo "Error in uploading the file!"; } // close ftp_close($con); ?>
Advertisements