Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Don't get stuck just because there isn't a native solution; a hack of one line can solve your problem without messing with Apache configuration (that in some hostings is prohibited or very restricted):</p> <p><strong>PHP to the rescue:</strong></p> <pre><code>var size = &lt;?php echo filesize('file.json') ?&gt;; </code></pre> <p>That's it, you probably already know the rest, but just as a reference here it is:</p> <pre><code>&lt;script&gt; var progressBar = document.getElementById("p"), client = new XMLHttpRequest(), size = &lt;?php echo filesize('file.json') ?&gt;; progressBar.max = size; client.open("GET", "file.json") function loadHandler () { var loaded = client.responseText.length; progressBar.value = loaded; } client.onprogress = loadHandler; client.onloadend = function(pe) { loadHandler(); console.log("Success, loaded: " + client.responseText.length + " of " + size) } client.send() &lt;/script&gt; </code></pre> <p><strong>Live example:</strong></p> <p>Another SO user thinks I am lying about the validity of this solution so here it is live: <a href="http://nyudvik.com/zip/" rel="nofollow noreferrer">http://nyudvik.com/zip/</a>, it is gzip-ed and the real file weights 8 MB</p> <p><br></p> <hr> <p>Related links:</p> <ul> <li><a href="https://serverfault.com/questions/183843/content-length-not-sent-when-gzip-compression-enabled-in-apache">SO: Content-Length not sent when gzip compression enabled in Apache?</a></li> <li><a href="http://httpd.apache.org/docs/2.2/mod/mod_deflate.html" rel="nofollow noreferrer">Apache Module mod_deflate doc</a></li> <li><a href="http://php.net/manual/en/function.filesize.php" rel="nofollow noreferrer">PHP filsize function doc</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload