Hi,
I have a client needs to convert this piece of code from php to asp
PHP Code:
<?
//create the ActiveSocket FTP object
$activeFtp = new com("ActiveXperts.FtpServer");
if(isset($_GET['method'])){
//set the logfile:
$activeFtp->logfile = $_POST["logfile"];
//connect the server
$activeFtp->connect($_POST["server"], $_POST["username"], $_POST["password"]);
//change directory
$activeFtp->ChangeDir($_POST["dir"]);
//display the table in witch we are going to present our information
echo "<table>";
echo " <tr>";
echo " <td colspan=1 class=header>";
echo "Size:";
echo " </td>";
echo " <td class=header>";
echo "Filename:";
echo " </td>";
echo " </tr>";
//get the firstfile (if the first file is fetched, move on to the next untill there is no next file, then an error will occure)
$files = $activeFtp->FindFirstFile();
//get the errors and descriptions
$error = $activeFtp->Lasterror;
$description = $activeFtp->GetErrorDescription($activeFtp->Lasterror);
//if the filename was successfully fetched, echo the filename and the filesize
while($activeFtp->Lasterror == 0){
echo " <tr>";
echo " <td class=size>";
//check if the file is a directory
if($files->isDirectory == -1){
//if the file is a directory: echo "Directory"
echo "Directory";
}
else{
//if the file isn't a directory, echo the filesize
echo $files->size . " Bytes";
}
echo " </td>";
echo " <td class=filename>";
echo $files->name . "<br>";
echo " </td>";
echo " </tr>";
//find the next file, and display it again..
$files = $activeFtp->FindNextFile;
}
//close the table tag
echo "</table>";
echo "<br>";
//close the if statement
}
//create a table and display the errors that have occured
echo "<table>";
echo " <tr>";
echo " <td colspan=1 class=header>";
echo "ErrorNo.:";
echo " </td>";
echo " <td class=header>";
echo "Error description:";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td class=size>";
echo $error;
echo " </td>";
echo " <td class=filename>";
echo $description;
echo " </td>";
echo " </tr>";
echo "</table>";
?>