Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
Design
/
fileman
/
Fusion
/
FTP
:
ftp001.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php //// https://www.w3schools.com/php/func_ftp_pasv.asp if (isset($_POST['submit']) && $_FILES["srcfile"]["error"] == 0) { echo "Coucou ..."; // print_r($_SERVER); $fileName = $_FILES['srcfile']['name']; // FTP settings $ftp_server = 'ftp.cluster011.hosting.ovh.net'; $ftp_username = 'analogde'; $ftp_password = 'rainbow'; // Define some variables $server_dir = 'demo.pagos.cafisa.org/php_upload_and_download_files_via_ftp_server/uploads/'; // change this $server_dir = 'http://analog-design.net/Fusion/FTP/'; //////home/analogde/www $server_dir = '/home/analogde/www/Fusion/FTP/'; // Specify the path of the file to upload $local_file = $_FILES['srcfile']['tmp_name']; // Specify the path and file name where will be uploaded $server_file = $server_dir . $fileName; echo $server_file ."<br><br>"; $ftpcon = ftp_connect($ftp_server) or die('Could not connect to $ftp_server'); echo "Id " .$ftpcon ."<br><br>"; // login with username and password $login_result = ftp_login($ftpcon, $ftp_username, $ftp_password); echo "Login " .$login_result ."<br><br>"; echo "Chemin " .ftp_pwd($ftp_conn); // change the current directory to php ftp_chdir($ftpcon, "207"); // output current directory name (/php) echo ftp_pwd($ftpcon); ftp_pasv($ftpconn, true); $contents = ftp_nlist($ftpcon, "www"); // output $contents var_dump($contents); if (ftp_put($ftpcon, $server_file, $local_file, FTP_BINARY)) { $statusMsg = 'The file ' .$fileName. ' uploaded successfully to FTP server!'; } else { $statusMsg = 'Error uploading ' .$fileName. ' file! Please try again later...'; // header('Location: index.php'); } echo $statusMsg ."<br><br>"; ftp_close($ftpcon); // ovh upload_tmp_dir no value // file_uploads on } /* $ftp_server="ftp.cluster011.hosting.ovh.net"; $ftp_user_name="analogde"; $ftp_user_pass="rainbow"; $file = "";//tobe uploaded $remote_file = ""; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a file if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; exit; } else { echo "There was a problem while uploading $file\n"; exit; } // close the connection ftp_close($conn_id); */ ?>