tartou2 Posted February 15, 2011 Share Posted February 15, 2011 Hello everyone I was working on a code i found on the internet to remotely download a file on my server but for some reason, nothing is been downloaded. You help is required. index.php <html> <head> <title>Remote Upload Page</title> </head> <body> <form method="post" action="download.php"> <p align="center"><b><font face="Tahoma">Enter Download URL :</font></b></p> <p align="center"> <input type="text" name="Link" size="50" dir="ltr"> <input type="submit" name="submit" value="Upload" dir="ltr"> </p> </body> </html> download.php <?php define('BUFSIZ', 4095); $url = $_post['Link']; $dir = 'files/'; $rfile = fopen($url, 'r'); $lfile = fopen($dir . basename($url), 'w'); fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ); fclose($rfile); fclose($lfile); echo '<p align="center"><b><font face="Tahoma" size="5" color="#339933">File Remote Download Complete !</font></b></p>'; ?> I hope anyone can fix this. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/227781-remote-downloadupload/ Share on other sites More sharing options...
litebearer Posted February 16, 2011 Share Posted February 16, 2011 Try this or look into curl... <?php $url = $_post['Link']; $dir = 'files/'; $file1 = $dir . date("YmdHis") . ".ext"; /* where ext is the extension of the file to download */ $contents = file_get_contents($url) file_put_contents($file1, $contents); echo '<p align="center"><b><font face="Tahoma" size="5" color="#339933">File Remote Download Complete !</font></b></p>'; ?> Link to comment https://forums.phpfreaks.com/topic/227781-remote-downloadupload/#findComment-1174804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.