Skip to content

Instantly share code, notes, and snippets.

@joviczarko
Last active May 14, 2022 15:54
Show Gist options
  • Save joviczarko/118eb71e7dfea7ae76877409d359ffba to your computer and use it in GitHub Desktop.
Save joviczarko/118eb71e7dfea7ae76877409d359ffba to your computer and use it in GitHub Desktop.
Upload file from URL
<!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