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.
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:
get1.php
or whatever and place it in a location you will be able to access on your domain.In get.php edit the file in the filemanager, and put this code: <?php exec("wget http://domain.com/path-to-file.zip"); ?>
Now navigate to your file you created in step 1 in your browser, so it might be http://domain.com/get1.php
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.
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!
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:
Instructions:
index.php
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)<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With