I have a site to upload and download files, I want to make a progress
of download similar to Mega
, take a look at the download page: page .. I already tried to do more I could not, can someone please help me?
I have a site to upload and download files, I want to make a progress
of download similar to Mega
, take a look at the download page: page .. I already tried to do more I could not, can someone please help me?
You can use the jquery ajax function or the plugin form as well, it's very simple to use the plugin, try this:
About ajax in jquery you can see more here: link
JSFiddle of the jquery plugin example: link
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script><scriptsrc="http://malsup.github.com/jquery.form.js"></script>
<script>
(function() {
var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');
$('form').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
},
success: function() {
var percentVal = '100%';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function(xhr) {
status.html(xhr.responseText);
}
});
})();
</script>
<div class="progress">
<div class="bar"></div >
<div class="percent">0%</div >
</div>
<div id="status"></div>