Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta charset="UTF-8">
- <title>UPLOAD</title>
- </head>
- <body>
- <form action="upload.php" method="post" enctype="multipart/form-data">
- <input type="file" name="archivio">
- <input type="submit" name="invia">
- </form>
- </body>
- </html>
- ----------------------------------------------------------------------
- <?php
- // dati di connessione al server FTP
- $server = 'ftp.enricobandiziol.com';
- $username = 'enricobandiziol.com';
- $password = 'aGieC7Xa';
- $con_id = ftp_connect($server);
- //ftp_connect($server);
- $lr = ftp_login($con_id, $username, $password);
- if((!$con_id) || (!$lr)){
- echo 'errore nella connessione al ftp<br>';
- exit;
- }else{
- echo 'connesso correttamente<br>';
- $source_file=$_FILES['archivio']['tmp_name'];
- $destino="/htdocs/file-corso/".$_FILES['archivio']['name'];
- $nome=$_FILES['archivio']['name'];
- $submit=ftp_put($con_id,$destino,$source_file,FTP_BINARY);
- if(!$submit){
- echo 'errore nell\'upload<br>';
- exit;
- }else{
- echo 'inviato correttamente<br>';
- }
- echo '<a href="upload.html">torna indietro</a>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement