19

This might be a very common question but i searched lot and finally decided to get some expert advice.

I was wondering if someone have uploaded file directly from URL to cPanel file manager. I can upload file from my computer using upload tab in file manager but not able to find any option for extracting data from URL.

I have tried several forums, Q/A websites but got nothing. I will really appreciate if someone can brought this question on to expert's attention.

I have looked

http://forums.cpanel.net/f145/filemanager-upload-url-215911.html

http://forums.cpanel.net/f5/upload-via-url-305691.html

and my other places but found nothing but the question.

7 Answers 7

31

I too had this question. Being on a slow connection downloading and then uploading again wasn't an option for me.

There isn't any way to do this through the cPanel filemanager at present. If you don't have access to SSH you can get around it like this:

  1. Create a new file in the filemanager, call it get1.php or whatever and place it in a location you will be able to access on your domain.
  2. In get.php edit the file in the filemanager, and put this code: <?php exec("wget http://domain.com/path-to-file.zip"); ?>

  3. Now navigate to your file you created in step 1 in your browser, so it might be http://domain.com/get1.php

  4. Wait. The page might return a 500 error, thats OK, the wget command should still go through.
  5. In cPanel in your file manager reload the directory where you put get1.php, you will see the file there waiting for you. Done.

Now of course this is highly insecure as any bot or person could just request your get1.php file, so make sure you delete it after your done. This is just a simple hack, any better ideas appreciated.

4
  • 1
    This is a valid work-around. However, some hosting providers may disable "exec", which will prevent it from working. In the event that it will work in your case, to increase the security of the strategy, create the PHP script file in a directory with NOINDEX (best to create your own directory for this purpose; if you navigate in a browser to that directory URL and can't see the files contained, then no bot can scan it), and use a complex filename. Of course, remember to remove the file when done.
    – cowb0y
    Aug 18, 2014 at 6:51
  • Though this is not exactly I was Looking for,But its Good Answers. I will wait for someone else might have better suggestions. Thanks @cowb0y for your keen review of Answers and Question Thanks BlissOfBeing for providing a way-around. :)
    – Shiva
    Aug 19, 2014 at 15:26
  • FYI, there is a cPanel feature request to add this. You may want to subscribe to the request and up-vote it. The only other thought I had was that you could use a CMS hosted on the cPanel account to transfer the file, or create a PHP script to do so (but consider the security implications carefully; never leave a convenience hack "lying around" for someone to discover).
    – cowb0y
    Aug 19, 2014 at 19:37
  • This didn't work for me even if it seemed such a simple solution.
    – elano7
    Feb 20, 2021 at 11:18
12

I had the same issue. I couldn't upload some big files which I needed to transfer from one server to another. Both FTP and cPanel File Manager kept failing. I created an upload.php file (extending the solution offered above) and copied it to the destination directory. I couldn't believe how quickly this technique works! It literally took seconds for 50MB files. Here are the contents of my php file:

<!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>

After I finish transferring my files, I always remove this php file from the server, so as not to give potential hackers an easy way to replace files on my server. Please do not forget this important step!

1
  • DUDE!!! Thanks a lot! you saved me hundreds of dollars worth of internet data. Feb 6 at 9:19
3

Used script and instructions from PHP Url File Remote Uploader No Size Limit and with some changes for more security,

here is the end result:

remote upload

Instructions:

  1. Create a directory and paste code below in file named index.php
  2. In the created directory create another directory named files and its change permission to 766 (this prevents hackers from uploading php files and potentially hacking you, you can still access the file from cpanel but you cant download it from your browser, if you want to download it from browser change permission to 777 but remember to change it back or delete the file)
  3. Enjoy
<title>Remote Upload</title>
<center>

</br</p></br</p><form method="post">
<input name="url" size="50" />
<input name="submit" type="submit" />
</form>

<b>Instruction:</b>
</p>Sample values for ftp and http
</p>ftp://username:[email protected]/path/to/file.png
</p>ftp://example.com/path/to/file.png
</p>http://www.example.com/path/to/file.png

<?php

// maximum execution time in seconds
set_time_limit (24 * 60 * 60);

if (!isset($_POST['submit'])) die();

// folder to save downloaded files to. must end with slash
$destination_folder = 'files/';

$url = $_POST['url'];
$newfname = $destination_folder . basename($url);

$file = fopen ($url, "rb");
if ($file) {
  $newf = fopen ($newfname, "wb");

  if ($newf)
  while(!feof($file)) {
    fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
  }
}

if ($file) {
  fclose($file);
}

if ($newf) {
  fclose($newf);
}

?>
</center>
3

Create a new .php file in your directory and paste the code below in it.

after running the script, it uploads in a file named test.zip

<?php
copy("YOUR_URL", "test.zip");
?>
1
  • this did the job on shared hosting providers where exec() is disabled Dec 19, 2021 at 8:07
2

Best Way

This Worked For Large Files

  1. First create a file on the public_html "get.php"

  2. Copy blow code and save

  3. Replace YOUR_URL with your URL

  4. Open the sitename.com/get.php

  5. Enjoy :)

code:

<?PHP
    ini_set('max_execution_time', '0');
    define('BUFSIZ', 4095);
    $url = 'YOUR_URL'; 
    $rfile = fopen($url, 'r');
    $lfile = fopen(basename($url), 'w');
    while(!feof($rfile))
    fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
    fclose($rfile);
    fclose($lfile);
    ?>
1

Well Yes OfCourse There Is A Way

U Can Use "wget" in your ssh console

just open your ssh console type in wget command: for eg : wget ;

and you are done

2
  • Thanks For response. I think I do not have SSH enabled. Is there any way to do it from cPanel itself .. ?
    – Shiva
    Apr 15, 2014 at 11:49
  • 3
    This does not answer the question which was asked. Many cPanel users don't have shell access.
    – cowb0y
    Aug 18, 2014 at 6:45
0

You can use RapidLeech. It's a CMS to "Transload" files (server-to-server) instead of uploading. But the Hosts usually ban you for using RL, because it consumes too much resources. But it has really cool functions. You can get Youtube videos directly with any screen size you want, and also you can transload your files back to famous file uploading websites such as 4shared by providing your account info.

Not the answer you're looking for? Browse other questions tagged or ask your own question.