Last active
May 14, 2022 15:54
-
-
Save joviczarko/118eb71e7dfea7ae76877409d359ffba to your computer and use it in GitHub Desktop.
Upload file from URL
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Upload file from URL</title> | |
<!-- From: https://stackoverflow.com/questions/22823204/is-there-any-way-to-upload-file-directly-from-url-in-filemanager-of-cpanel --> | |
</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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment