Click here to Skip to main content
13,863,714 members
Click here to Skip to main content
Add your own
alternative version

Stats

9.6K views
351 downloads
3 bookmarked
Posted 29 Apr 2015
Licenced CPOL

ServerZilla: FTP Client for Server

, 29 Apr 2015
Rate this:
Please Sign up or sign in to vote.
FTP Client for Web server.

Introduction

The aim of our project ‘ServerZilla’ is to encourage transfer files between remote host and FTP server. And this project manages files in both remote host and FTP server. Currently, remote administrator uses TFTP (Trivial File Transferring Protocol) to connect remote host to FTP server. To execute TFTP, the administrator needs to spawn a shell using back connect or SSH (secured shell ).This application is based on Command Line Interface (CLI) and has several commands to encourage transfer files between remote host and FTP server which is very difficult for a normal user. Hence by doing this project, reduce this problem. This project uses a web interface which will be user friendly. 

Objectives

  • Enable the administrator to connect the web server with FTP server.
  • Provide impressive and user-friendly interface.
  • Save time of administrator.
  • Transfer files between web server and FTP server.
  • Enable administrator to browse the files in web server and FTP server.
  • Enable administrator to manage the files in web server and FTP server.

Using the Code

The project used technologies like:

  • PHP
  • JavaScript
  • CSS3
  • jQuery
  • bootstrap
  • bootbox, etc

Let's start with FTP functions used in the program.

To connect to FTP server, the function ftp_connection() is used. The syntax of ftp_connect() is:

$conn = ftp_connect("hostname");

The variable $conn is the handler to connection to the FTP server. Later, it is used as reference to the connection.

The next function is to login to FTP server. The function ftp_login() is used to login to FTP server. The syntax is:

$login = ftp_login($conn, $usr, $pass);

The $usr is variable in which we have stored the username of user and $pass is the variable in which we have stored password of user.

To change the current working directory of FTP server, the function ftp_chdir() is used. The syntax is:

ftp_chdir($conn, $fpath);

The next function of FTP client is upload file to FTP server. To upload files to FTP server, the function ftp_put() is used. The syntax is:

ftp_put($conn, $rFile, $lFile, FTP_BINARY);

The variable $rFile stores the name of remote file, $lFile stores the name of local file and FTP_BINAY is the mode of operation.

The next operation of FTP client is download file. To download files to web server, the function ftp_get() is used. The syntax is:

ftp_get($conn, $lFile, $rFile, FTP_BINARY);

The variable $lFile stores the name of local file, $rFile stores the name of remote file and FTP_BINARY is the mode of operation.

The renaming of files is another function of FTP client. To rename a file on FTP host, the function ftp_rename() is used. The syntax is:

ftp_rename($conn, $oldname, $newname);

I hope you understand what the variables are used for.

The deletion of file is another function of FTP client. To delete files, the function ftp_delete() is used. The syntax is:

ftp_delete($conn, $file);

Deleting directory is the hard part because to delete a directory, the directory must be empty. So we use a recursive function to delete directory. The function code is:

function deleteFDir($conn, $path)
{
    $list = getfiles(ftp_pwd($conn).'/'.$path);
    foreach($list as $item)
    {
        if($item['type']=='Directory')
        {
            deleteFDir($conn, $path.'/'.$item['name']);
        }
        else {
            ftp_delete($conn, $path.'/'.$item['name']);
        }
    }
    if(ftp_rmdir($conn, $path))
    {
        return true;
    }
    else {
        return false;
    }
}

To create a new directory  in FTP server, the function ftp_mkdir() is used. The syntax is:

ftp_mkdir($conn, $dir);

I hope you understand all functions used to develop the program. You can check the program source code for further understanding. 

Screenshots

Configure

Hope you like the program...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

AjithKp560_
Student MCA student at School of Information Science and T
India India
Name Ajith Kp. I'm MCA student at School of Information Science and Techonolgy, Kannur University Campus, Mangattuparamba. I like programming as well as computer/network security analyzing. I'm concentrating programming in Android, PHP, Python, Ajax, JQuery, C# and JAVA.

Blog: http://www.terminalcoders.blogspot.in
Web : http://www.tctech.in

I'm working as freelance PHP, Android, Python and Java developer. Please contact me at ajithkp560@gmail.com

You may also be interested in...

Comments and Discussions

 
QuestionGreat tutorial Pin
Mick du Gland30-Apr-15 4:31
memberMick du Gland30-Apr-15 4:31 
GeneralRe: Great tutorial Pin
AjithKp560_30-Apr-15 5:26
professionalAjithKp560_30-Apr-15 5:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190214.1 | Last Updated 29 Apr 2015
Article Copyright 2015 by AjithKp560_
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid