Introduction:

In today's article, I will guide you, How to remotely upload a file in cPanel via link or URL. So let's get started.

  • Firstly, go to your cPanel account, and then login.
  • After that, find out the Files section, and then here you can see the File Manager option.
  • Simply click on it, and then go inside to the public_HTML. So now here you need to create a file with the name of testing.php.
  • So now select your created file and then right click on it.
  • Here you can see the Edit option, So simply click on it, and then again click on edit button.
  • So now enter the following code inside the file, and don't forget to replace the URL with your custom URL that you would like to download.
  • Once you're done, then click on this Save Changes button, and then your file has been saved.
  • So now search the URL from outside, and then it will automatically download the URL content.
  • Now reload the directory, and then check the downloaded content in public_HTML.

<?php
define('BUFSIZ', 4095);
$rfile = fopen($url, 'r');
$lfile = fopen(basename($url), 'w');
while(!feof($rfile))
fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
fclose($rfile);
fclose($lfile);
?>

Was this answer helpful? 147 Users Found This Useful (221 Votes)