Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Home</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  6. </head>
  7. <body>
  8. <form method="get" action="remote2.php">
  9. <input type="text" name="url" placeholder="Enter URL with http://" />
  10. <input type="text" name="name" placeholder="File Name.jpg" />
  11. <input type="text" name="path" placeholder="File Path" />
  12. <input name="submit" type="submit" value="Upload" />
  13. </form>
  14. <?php
  15. set_time_limit (24 * 60 * 60);
  16. if (!isset($_GET['submit'])) die();
  17. $destination_folder = 'uploads/';
  18. $url = $_GET['url'];
  19. $name = $_GET['name'];
  20. $file_exist = $_GET['path'];
  21. $newfname = $destination_folder . basename($name);
  22. $file = fopen ($url, "rb");
  23. if ($file) {
  24. $newf = fopen ($newfname, "wb");
  25. if ($newf)
  26. while(!feof($file)) {
  27. fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
  28. }
  29. }
  30. if ($file) {
  31. fclose($file);
  32. }
  33. if ($newf) {
  34. fclose($newf);
  35. }
  36. if (file_exists($file_exist)) {
  37. header('Pragma: public');
  38. header('Content-Type: application/octet-stream');
  39. header('Content-Disposition: attachment; filename="'.basename($name).'"');
  40. header('Content-Transfer-Encoding: binary');
  41. echo readfile(str_replace(" ","%20",$file_exist));
  42. exit;
  43. } else {
  44. header('Pragma: public');
  45. header('Content-Type: application/octet-stream');
  46. header('Content-Disposition: attachment; filename="'.basename($name).'"');
  47. header('Content-Transfer-Encoding: binary');
  48. echo readfile(str_replace(" ","%20",$url));
  49. exit;
  50. }
  51. ?>
  52. </body>
  53. </html>
  54.  
  55. /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