<?php
if ($_GET['file']){
// This assumes the file to be downloaded is a zipped file
$dest_file = fopen ("downloaded_file.zip", "w");
if (!$dest_file) {
echo "<p>Error: Unable to open for writing.\n";
exit;
}
$src_file = fopen ($_GET['file'], "r");
if (!$src_file) {
echo "<p>Error: Unable to remote open for reading.\n";
exit;
}
/* Write the data here. */
while (!feof ($src_file)) {
$line = fgets ($src_file, 1024);
fwrite ($dest_file, $line);
}
fclose ($dest_file);
fclose ($src_file);
echo "File succesfully downloaded<br/>";
}
?>
<form method = 'GET' action = 'download.php'>
<p>Enter full URL of file:</p>
<input type = 'text' style = 'width: 40%' name = 'file'/>
<br/>
<input type = 'submit' value = ' OK ' />
</form>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.