Shell File Manager

Current Path : /home/camscanae/public_html/admin/pages/
Upload File :
Current File : /home/camscanae/public_html/admin/pages/test.php

<?php
//check if form is submitted
if (isset($_POST['submit'])) {
    // ftp settings
    $ftp_hostname = '3.69.213.38'; // change this
    $ftp_username = 'bitnami'; // change this
    $ftp_password = 'ZYbKmUAycrY0'; // change this
    $remote_dir = './uploads'; // change this
    $src_file = $_FILES['srcfile']['name'];

    //upload file
    if ($src_file != '') {
        // remote file path
        $dst_file = $remote_dir . $src_file;

        // connect ftp
        $ftpcon = ftp_connect($ftp_hostname) or die('Error connecting to ftp server...');

        // ftp login
        $ftplogin = ftp_login($ftpcon, $ftp_username, $ftp_password);

        // ftp upload
        if (ftp_put($ftpcon, $dst_file, $src_file, FTP_ASCII))
            echo 'File uploaded successfully to FTP server!';
        else
            echo 'Error uploading file! Please try again later.';

        // close ftp stream
        ftp_close($ftpcon);
    } else
        header('test.php');
}
?>

<!DOCTYPE html>
<html>

<head>
    <title>Upload Files to FTP Server in PHP</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <br />
    <div class="container">
        <div class="col-xs-8 col-xs-offset-2 well" style="background:none;">
            <form action="test.php" method="post" enctype="multipart/form-data">
                <legend>Please Choose File to Upload</legend>
                <div class="form-group">
                    <input type="file" name="srcfile" />
                </div>
                <div class="form-group">
                    <input type="submit" name="submit" value="Upload File to FTP Server" class="btn btn-warning" />
                </div>
            </form>
        </div>
    </div>
</body>

</html>

Shell File Manager Version 1.1, Coded By Shell
Email: [email protected]