title: How to add a progress bar to script that downloads file from url to server
body: <p>I have searched for a script that download files from url to server and I came across this script.  It works fine but I want to add some things to it like multi urls and progress bar. As I am new in php I know a little .</p>
  
  <p>Here is the script in which I want to implement:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;html&gt;
  &lt;form method="post"&gt;
  &lt;input name="url" size="50" /&gt;
  &lt;input name="submit" type="submit" /&gt;
  &lt;/form&gt;
  &lt;?php
      // maximum execution time in seconds
      set_time_limit (24 * 60 * 60);
  
      if (!isset($_POST['submit'])) die();
  
      // folder to save downloaded files to. must end with slash
      $destination_folder = 'downloads/';
  
      $url = $_POST['url'];
      $newfname = $destination_folder . basename($url);
  
      $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);
      }
  ?&gt;
  &lt;/html&gt; 
  </code></pre>