ftp_rawlist() function in PHP


The ftp_rawlist() function displays the list of files with file information from a specified directory

Syntax

ftp_rawlist(conn,dir,recursive);

Parameters

  • conn − The FTP connection

  • dir − The directory path

  • recursive − Sends a "LIST" command to the server by default.

Return

The ftp_rawlist() function returns an array where each element corresponds to one line of text.

Example

The following is an example to get a list of files with file information −

<?php
   $ftp_server = "192.168.0.4";
   $ftp_user = "jacob";
   $ftp_pass = "tywg61gh";
   $con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
   $login = ftp_login($con, $ftp_user, $ftp_pass);
   $file_list = ftp_rawlist($ftp_conn, "/");
   // close connection
   ftp_close($conn);
   var_dump($file_list);
?>

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 30-Jul-2019

49 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements