Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.22 KB | None | 0 0
  1. <html>
  2. <head><title>StarCraft 2 Replay Upload</title>
  3. <link rel="stylesheet" type="text/css" href="upload.css" />
  4. <link rel="shortcut icon" href="favicon.ico" >
  5. </head>
  6. <body><center>
  7. <table>
  8. <tr>
  9. <td width="*" valign="top"><div id="frame">
  10.  
  11.  
  12. <div class="title">StarCraft 2 Replay Upload</div>
  13.  
  14.  
  15. <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data">    
  16.  
  17. <div class="subtitle"></div>
  18.  
  19. <div class="entry">
  20. <div class="container">
  21. <input type="file" name="File" id="file" size="27"/>
  22. </div>
  23. </div>
  24.  
  25.  
  26. <div class="entry">
  27. <div class="container">
  28. <form><input type="text" name="FTPupload" size="27" value="/"/> <input type="submit" name="submit" value="Upload!" />
  29. <a href="javascript:window.open('/help.php', 'WinName', 'width=420,height=80');">?</a>
  30. <input type="hidden" name="submitted" value="TRUE" />
  31. </div>
  32. </div>
  33.  
  34. </form>
  35.  
  36.  
  37. <div class="entry">
  38. <div class="container">
  39. Note: [Replay files/packages ONLY.]<br>
  40. Files of any other sort will be removed.<br>
  41. Complete FTP Directory <a href="javascript:window.open('127.0.0.1', 'WinName');">here</a>.<br>
  42. </div>
  43. </div>
  44. </div>
  45.  
  46.  
  47. </td></tr></table>
  48.  
  49.  
  50. </center></body>
  51. </html>
  52.  
  53. <?php
  54. //Initial FTP Connection
  55.  
  56.     $user='JSP';
  57.     $pass='JSP';
  58.     $ftp_path = $_POST["FTPupload"];
  59.     $local_file = $_POST["File"];
  60.  
  61.     $ftpstream = @ftp_connect('127.0.0.1') or die ("Cannot connect");           //Connect to the FTP server
  62.     $login = @ftp_login($ftpstream, $user, $pass) or die ("Invalid details");       //Login to the FTP server
  63.  
  64.  
  65.     $temp = tmpfile();
  66.     $move_uploaded_file ( $local_file , $ftp_path);
  67.     $uploads_dir = $ftp_path;
  68.     foreach ($_FILES["File"]["error"] as $key => $error) {
  69.        if ($error == UPLOAD_ERR_OK) {
  70.          $tmp_name = $_FILES["File"]["tmp_name"][$key];
  71.          $name = $_FILES["File"]["name"][$key];
  72.         move_uploaded_file($tmp_name, "$uploads_dir/$name");
  73.      }
  74.     }
  75.     $ftp_put($ftpstream, $ftp_path, $local_file, FTP_BINARY);  
  76.     $upload = ftp_put($local_file);
  77.  
  78.  
  79.     ftp_close($conn_id);                   
  80. //Closes connection to FTP server.
  81.  
  82.     if (file_exists($ftp_path))
  83.     {
  84.     echo "File was uploaded at ftp://115.64.233.52$ftp_path";
  85.     }
  86.     else
  87.     {
  88.     echo "Could not upload to $ftp_path";
  89.     }
  90. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement