Created
July 1, 2014 06:59
-
-
Save seangenabe/86a8467468596fe8b706 to your computer and use it in GitHub Desktop.
Download files to a remote server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['url'])) { | |
if (empty($_POST['filename'])) { | |
$filename = 'download.bin'; | |
} | |
else { | |
$filename = $_POST['filename']; | |
} | |
# Credits: http://stackoverflow.com/a/3938551/1149962 | |
file_put_contents($filename, $url); | |
exit('Done.'); | |
} | |
?> | |
<form method="POST"> | |
<label> | |
<span>URL: </span> | |
<input type="text" name="url"> | |
</label> | |
<label> | |
<span>Filename: </span> | |
<input type="text" name="filename"> | |
</label> | |
<input type="submit" value="Submit"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment