Wednesday, May 9, 2018

Upload A File To cpanel From Another Server/URL?

How to Upload A File To cpanel From Another Server/URL?


Uploading data from one cpanel to another is very easy using this script.
Other wise its very pathetic and very time take task to download the data from one cpanel/server to your own computer, then upload it on the 2nd cpanel/server.

There are only few steps:-

  • compress your data folder (zip, tar, etc)
  • copy the link of that compress zip file. (eg attaakwal.blogspot.com/backup/backup.zip)
Then login your new cpanel/server:-
  • create a new file with any name, (eg upload.php)
  • paste this code and click upload button.
  • that's it.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

<!DOCTYPE html>
<html>
<head>
    <title>Upload file from URL</title>
</head>
<body>
<?php
    $BASE_URL = strtok($_SERVER['REQUEST_URI'],'?');
    if (isset($_POST['url'])){
        $url = $_POST['url'];
        echo "Transferring file: {$url}<br>";
        exec("wget {$url}");
    }
?>
    <form name='upload' method='post' action="<?php echo $BASE_URL; ?>">
        <input type='text' id='url' name='url' size='128' /><br>
        <input type="submit" value="Upload">
    </form>
</body>
</html>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Once you have done, make sure that you have removed the script/file (upload.php), cause hackers can  upload malicious files to your webserver!

Cheers!!!

0 comments: