i need another help...
i'm using another script to deal with remote file listing...
<?php
$ftp_host = "xx.xx.xx.xx";
$ftp_user = "USERID";
$ftp_password = "PASSWORD";
//Connect
echo "<br />Connecting to server...";
$conn = ftp_connect($ftp_host);
$login = ftp_login($conn, $ftp_user, $ftp_password);
//
//Enable PASV ( Note: must be done after ftp_login() )
//
$mode = ftp_pasv($conn, TRUE);
//Login OK ?
if ((!$conn) || (!$login) || (!$mode)) {
die("FTP connection has failed !");
}
echo "<br />Login Ok.<br />";
//change directory
ftp_chdir($conn, "DIR");
// make your FTP connection calls here, then ...
$contents = ftp_rawlist($conn, ".");
// start listing file
echo '<TABLE border=1>';
foreach ($contents as $key => $value) {
$info = explode(" ", $value);
$clean = array();
foreach ($info as $key => $value) {
if (!empty($value)) { $clean[] = $value; }
} // end foreach loop 2
// unwanted file extension
$extarray=explode(".",$clean[8]);
$ext=$extarray[count($extarray)-1];
if ( ($ext != "html") && ($ext != "jpg") && ($ext != "incl") ) {
echo '<TR>';
print "<TD WIDTH=\"60%\" class=\"txt\"><font size=\"2\" face=\"verdana\"><a href=\"http://url/dir/$clean[8]\">$clean[8]</a></font></TD>"; // file name
// prep size
$size = $clean[4];
$size = $size / 1000; $size = ceil($size); if ($size <= 0) { $size = 1; }
if ($size >= 1000) { $measure = "MB"; $size = $size / 1000; } else { $measure = "K"; }
print "<TD WIDTH=\"20%\" ALIGN=\"CENTER\" class=\"txt\"><font size=\"2\" face=\"verdana\">$size $measure</font></TD>"; // file size
print "<TD WIDTH=\"20%\" ALIGN=\"CENTER\" class=\"txt\"><font size=\"2\" face=\"verdana\">$clean[5] $clean[6] $clean[7]</font></TD>"; // file date
echo '</TR>';
} // end if
} // end foreach loop 1
echo '</TABLE>';
//close
ftp_close($conn);
?>
the script works but when it trying to list a file that has "space" it wont show the whole file name... maybe it's because i explode the file name... how can i fix this?
the file name
"This is the file name.ext"
showed
"This"