Create FTP in local server using XAMPP
- Start Apache
- Start FileZilla
- Go to C:\xampp\FileZillaFTP and start FileZilla Server Interface.exe
- By Default there is 2 existing users "Annonomous" and "newusers". Add a new user and grant access to the specified folder you want.
- 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:
Post a Comment