This class is designed for reading drives ,directories and Files.
Files writing is also possible
Hope this function works well with remote files.(iff u have the permissions to access it)
for entering username & password u can use
http://uname:password@domain.com/ am not sure please check this format
ftp://uname:password@ftp.com/ am not sure please check this format
<?
Class FileBrowser
{
var $fval=0;
function dir_read($f_name) // Function to read directories
{
if ($handle = opendir($f_name))
{
print( "<html><B>Directory Name:".$f_name."<B><BR>");
print("<B>Files in the directory:<BR>");
print("<form method=\"POST\" action=\"ex.php\">");
print("<select size=1 name=fname>");
while (false !== ($file = readdir($handle)))
{
if ( $fval>1)
{
if (is_file($file))
{
print("<option value=\"$f_name"."/$file\" >".$file."</option>\n");
}
else
{
print("<option value=\"$f_name"."/$file\"><a href=\"dir2box.php?fname=\"$f_name"."$file\">$file</a></option>\n");
}
}
else
{
if (is_file($file))
{
print("<option value=\"$f_name"."$file\" >".$file."</option>\n");
}
else
{
print("<option value=\"$f_name"."$file\"><a href=\"dir2box.php?fname=\"$f_name"."$file\">$file</a></option>\n");
}
}
$fval=$fval+1;
}
Shea Sollars wrote :1348
This deserves a low rate. It was not the whole program, the class was not explained, and there are many bugs. Maybe explain what "print("<form method=\"POST\" action=\"ex.php\">");" is all about, and "print("<option value=\"$f_name"."/$file\"><a href=\"dir2box.php?fname=\"$f_name"."$file\">$file</a></option>\n");" is, it would be alot better. I mean, what is "dir2box.php" and "ex.php" all about?!