progress bar for uploading file in php code example

Example: progress bar for uploading file in php

$(document).ready(function() { $('#uploadForm').submit(function(e) { if($('#userImage').val()) { e.preventDefault(); $('#loader-icon').show(); $(this).ajaxSubmit({ target: '#targetLayer', beforeSubmit: function() { $("#progress-bar").width('0%'); }, uploadProgress: function (event, position, total, percentComplete){ $("#progress-bar").width(percentComplete + '%'); $("#progress-bar").html('
' + percentComplete +' %
') }, success:function (){ $('#loader-icon').hide(); }, resetForm: true }); return false; } }); });

Tags:

Misc Example