Jump to content

ftp_rawlist


Pro.Luv

Recommended Posts

Hi,

 

I'm having a problem using ftp_rawlist when I chmod a file the permissions are updated but it doesn't show when I list the files it shows the file's old permissions, but when I view the file permissions using FileZilla it shows that the file has been updated.

 

Example:

Before ftp_chmod

file.php -rw-r--r--

 

After I chmod the file using the code below it still shows the -rw-r--r-- permissions it doesn't update but using filezilla shows that it's permissions have been updated.

 

 

This is the FTP_chmod code that I use:

	$conn_id = ftp_connect($host);		
	$login_result = ftp_login($conn_id, $user, $pass);	    
	$file = $_GET["file"];
    	  
	if (ftp_chmod($conn_id, 0644, $file) !== false) {
	    Print "$file chmoded successfully to 0644\n";
	} else {
	    Print "could not chmod $file\n";
	}

 

This is the function that I use to list the files on a server:

 

function raw_listing($conn, $path){

$list = ftp_rawlist($conn, "./"); //GET RAW DIRECTORY LIST	

        $i = 0;
    foreach ($list as $current) {
	$split = preg_split("[ ]", $current, 9, PREG_SPLIT_NO_EMPTY);
	if ($split[0] != "total") {
	    $parsed[$i]['isdir'] = $split[0]{0} === "d";
	    $parsed[$i]['perms'] = $split[0];
	    $parsed[$i]['number'] = $split[1];
	    $parsed[$i]['owner'] = $split[2];
	    $parsed[$i]['group'] = $split[3];
	    $parsed[$i]['size'] = $split[4];
	    $parsed[$i]['month'] = $split[5];
	    $parsed[$i]['day'] = $split[6];
	    $parsed[$i]['time/year'] = $split[7];
	    $parsed[$i]['name'] = $split[8];
	    $i++;
	}
    }
    return $parsed;
}

 

The listing of the files seem fine but it's only the permissions that show wrong.

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/209207-ftp_rawlist/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.