Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Home</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
- </head>
- <body>
- <form method="get" action="remote2.php">
- <input type="text" name="url" placeholder="Enter URL with http://" />
- <input type="text" name="name" placeholder="File Name.jpg" />
- <input type="text" name="path" placeholder="File Path" />
- <input name="submit" type="submit" value="Upload" />
- </form>
- <?php
- set_time_limit (24 * 60 * 60);
- if (!isset($_GET['submit'])) die();
- $destination_folder = 'uploads/';
- $url = $_GET['url'];
- $name = $_GET['name'];
- $file_exist = $_GET['path'];
- $newfname = $destination_folder . basename($name);
- $file = fopen ($url, "rb");
- if ($file) {
- $newf = fopen ($newfname, "wb");
- if ($newf)
- while(!feof($file)) {
- fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
- }
- }
- if ($file) {
- fclose($file);
- }
- if ($newf) {
- fclose($newf);
- }
- if (file_exists($file_exist)) {
- header('Pragma: public');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="'.basename($name).'"');
- header('Content-Transfer-Encoding: binary');
- echo readfile(str_replace(" ","%20",$file_exist));
- exit;
- } else {
- header('Pragma: public');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="'.basename($name).'"');
- header('Content-Transfer-Encoding: binary');
- echo readfile(str_replace(" ","%20",$url));
- exit;
- }
- ?>
- </body>
- </html>
- /remote2.php?file=https://i.stack.imgur.com/w0jUI.jpg&name=Rose.jpeg&path=uploads/Rose.jpeg*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement