• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

free upload from URL script

middlemore16

New Member
hi,

Im looking for a script which will let my server upload something from a URL.

Instead of downloading whatever I want then uploading it from my computer to the server.

thanks
sean
 
Code:
<?php
if ($_GET[xfer]) {
if ($_POST[from] == "") {
print "You forgot to enter a url.";
} else {
copy("$_POST[from]", "$_POST[to]");
$size = round((filesize($_POST[to])/1000000), 3);
print "transfer complete.<br>
<a><a href=\"$_POST[from]\">$_POST[from]</a><br>
<a><a href=\"$_POST[to]\">$_POST[to]</a> : $size MB";
}
} else {
print "<form action=\"$PHP_SELF?xfer=true\" method=post>
from([url]http://):[/url] <input name=from><br>
to(filename): <input name=to><br>
<input type=submit value=\"transload\">";
}
?>
A friend of mine wrote it a while ago. Feel free to use it. :/

I wrote a script that uses another way to do it , but your host might block system() or WGET:
Code:
<?php
$file = "http://blah.com/blah.ext";
ob_start();
system("wget $file 1> /tmp/cmdtemp 2>&1; cat /tmp/cmdtemp; rm /tmp/cmdtemp");
$output = ob_get_contents();
ob_end_clean();
echo str_replace(">", "&gt;", str_replace("<", "&lt;", $output));
?>
 
Last edited:
Hi, i know that this thread is years old already but i tried the first script in my host it didn't upload anything. I type in the url from example http://bla.cöm/bla.xtn and type name to test.zip but after that nothing is uploaded. Not knowing in what directory it will go so i set the main directory to 777 and applied it all to it's sub folders.
Any suggestion? I'm just using my mobile phone to build my site that why i need this upload script because opera mini 4.2 my browser can't upload via ftp.
Sorry for the english. I actually took me time to arrange this sentence of mine. lol.
By the way, i currently hosted my site in byethost.com for free because i'm still working on some experiment.
 
Back
Top