Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><title>StarCraft 2 Replay Upload</title>
- <link rel="stylesheet" type="text/css" href="upload.css" />
- <link rel="shortcut icon" href="favicon.ico" >
- </head>
- <body><center>
- <table>
- <tr>
- <td width="*" valign="top"><div id="frame">
- <div class="title">StarCraft 2 Replay Upload</div>
- <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data">
- <div class="subtitle"></div>
- <div class="entry">
- <div class="container">
- <input type="file" name="File" id="file" size="27"/>
- </div>
- </div>
- <div class="entry">
- <div class="container">
- <form><input type="text" name="FTPupload" size="27" value="/"/> <input type="submit" name="submit" value="Upload!" />
- <a href="javascript:window.open('/help.php', 'WinName', 'width=420,height=80');">?</a>
- <input type="hidden" name="submitted" value="TRUE" />
- </div>
- </div>
- </form>
- <div class="entry">
- <div class="container">
- Note: [Replay files/packages ONLY.]<br>
- Files of any other sort will be removed.<br>
- Complete FTP Directory <a href="javascript:window.open('127.0.0.1', 'WinName');">here</a>.<br>
- </div>
- </div>
- </div>
- </td></tr></table>
- </center></body>
- </html>
- <?php
- //Initial FTP Connection
- $user='JSP';
- $pass='JSP';
- $ftp_path = $_POST["FTPupload"];
- $local_file = $_POST["File"];
- $ftpstream = @ftp_connect('127.0.0.1') or die ("Cannot connect"); //Connect to the FTP server
- $login = @ftp_login($ftpstream, $user, $pass) or die ("Invalid details"); //Login to the FTP server
- $temp = tmpfile();
- $move_uploaded_file ( $local_file , $ftp_path);
- $uploads_dir = $ftp_path;
- foreach ($_FILES["File"]["error"] as $key => $error) {
- if ($error == UPLOAD_ERR_OK) {
- $tmp_name = $_FILES["File"]["tmp_name"][$key];
- $name = $_FILES["File"]["name"][$key];
- move_uploaded_file($tmp_name, "$uploads_dir/$name");
- }
- }
- $ftp_put($ftpstream, $ftp_path, $local_file, FTP_BINARY);
- $upload = ftp_put($local_file);
- ftp_close($conn_id);
- //Closes connection to FTP server.
- if (file_exists($ftp_path))
- {
- echo "File was uploaded at ftp://115.64.233.52$ftp_path";
- }
- else
- {
- echo "Could not upload to $ftp_path";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement