Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1.  
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>UPLOAD</title>
  6. </head>
  7. <body>
  8.  
  9. <form action="upload.php" method="post" enctype="multipart/form-data">
  10. <input type="file" name="archivio">
  11. <input type="submit" name="invia">
  12. </form>
  13.  
  14. </body>
  15. </html>
  16.  
  17. ----------------------------------------------------------------------
  18.  
  19. <?php
  20. // dati di connessione al server FTP
  21. $server = 'ftp.enricobandiziol.com';
  22. $username = 'enricobandiziol.com';
  23. $password = 'aGieC7Xa';
  24.  
  25. $con_id = ftp_connect($server);
  26. //ftp_connect($server);
  27.  
  28. $lr = ftp_login($con_id, $username, $password);
  29.  
  30. if((!$con_id) || (!$lr)){
  31. echo 'errore nella connessione al ftp<br>';
  32. exit;
  33. }else{
  34. echo 'connesso correttamente<br>';
  35.  
  36.  
  37. $source_file=$_FILES['archivio']['tmp_name'];
  38. $destino="/htdocs/file-corso/".$_FILES['archivio']['name'];
  39. $nome=$_FILES['archivio']['name'];
  40. $submit=ftp_put($con_id,$destino,$source_file,FTP_BINARY);
  41. if(!$submit){
  42. echo 'errore nell\'upload<br>';
  43. exit;
  44. }else{
  45. echo 'inviato correttamente<br>';
  46. }
  47. echo '<a href="upload.html">torna indietro</a>';
  48. }
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement