Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <html>
  2. <form method="post">
  3. <input name="url" size="50" />
  4. <input name="submit" type="submit" />
  5. </form>
  6. <?php
  7. // maximum execution time in seconds
  8. set_time_limit (24 * 60 * 60);
  9.  
  10. if (!isset($_POST['submit'])) die();
  11.  
  12. // folder to save downloaded files to. must end with slash
  13. $destination_folder = 'downloads/';
  14.  
  15. $url = $_POST['url'];
  16. $newfname = $destination_folder . basename($url);
  17.  
  18. $file = fopen ($url, "rb");
  19. if ($file) {
  20. $newf = fopen ($newfname, "wb");
  21.  
  22. if ($newf)
  23. while(!feof($file)) {
  24. fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
  25. }
  26. }
  27.  
  28. if ($file) {
  29. fclose($file);
  30. }
  31.  
  32. if ($newf) {
  33. fclose($newf);
  34. }
  35. ?>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement