php - Showing progress of AJAX file upload doesn't work -
i used file uploading process. when click browse button, file uploaded on server , display file contents without click submit button. when upload large size of file, upload take more time. needed implement progressbar. . used following code.
$.ajax({ url: "upload.php", type: "post", data: formdata, processdata: false, contenttype: false, beforesend: function() { status.empty(); var percentval = '0%'; bar.width(percentval) percent.html(percentval); $('register').ajaxform({}); }, onprogress: function(event){ var loaded = event.loaded, total = event.total; bar.width(parseint(loaded / total * 100, 10).limit(0, 100) + '%'); }, uploadprogress: function(event, position, total, percentcomplete) { var percentval = percentcomplete + '%'; bar.width(percentval) percent.html(percentval); }, complete: function(xhr) { bar.width("100%"); percent.html("100%"); status.html(xhr.responsetext); },
but progress bar not starting. display after uploading finishing 100% only.
i need every step step uploading percentage.
the problem following 2 function. these 2 function not calling.
onprogress: function(event), uploadprogress: function(event, position, total, percentcomplete)
i refered following useful links.
please me..
advance thanks.
Comments
Post a Comment