Tizag.com Webmaster Tutorials - A collection of webmaster tutorials from HTML to PHP.

Friday, February 5, 2010

Create FTP in local server using XAMPP

Create FTP in local server using XAMPP


  1. Start Apache
  2. Start FileZilla
  3. Go to C:\xampp\FileZillaFTP and start FileZilla Server Interface.exe
  4. By Default there is 2 existing users "Annonomous" and "newusers". Add a new user and grant access to the specified folder you want.
  5. now the specified folder in the localhost will allow to transfer files.

here is a following code that will connect the ftp server



<?php
$ftpUser = "biraj";
$ftpPassword= "password";
$ftpServer = "127.0.0.1";

$connId = ftp_connect($ftpServer);


if(@ftp_login($connId, $ftpUser, $ftpPassword)){
echo "FTP login successful";
}else{
print "\nError: FTP server found but unable to login.";
ftp_quit($connId);
exit;
}
ftp_mkdir($connId, $uploadDirectory);

ftp_close($connId);
?>

No comments: