PHP - Ftp_rawlist
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: Code: [Select] $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: Code: [Select] 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 Similar TutorialsHi, I am trying to build my own ftp script, but i encounter a problem to get the filemdate for SOME of the files, ftp_mdtm returns alright for some of the files, but for some its "-1", so its rather: January 01 1970 07:59:59. I dont actually know why tat is the case, because the function ftp_rawlist returns filemtime very accurately for ALL files, however, just in this format: drwxr-x--- 10 user 99 4096 Oct 4 19:21 . But since its in a line, not in a array, so the coding becomes messy, unusable. I also tried filemtime, filectime, and getlastmod, but the first two also returns 1970, getlastmod() seems to return the mod date of the current page, not the specified page. Thanks, Ted |