Click here to Skip to main content
15,217,218 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have create multiple file upload using ajax and jquery. i want to have a progress bar. but i dont know how , who can help me in this way?
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 4

Its not PHP solution, Javascript. Try the below, you can modify it properly to use
<HTML>
<style>
</style>
<SCRIPT>
function Slide(holder, width, height, SlideCount)//width and height in pixel
{
	var topDiv=document.createElement("DIV");
	topDiv.style.height=height;
	var currentPos=0;
	holder.appendChild(topDiv);
	
	var Child1=document.createElement("DIV");
	Child1.style.width=0;
	Child1.style.height=height;
	Child1.style.border="1px solid red";
	Child1.style.background="red";
	Child1.style.float="left";
	topDiv.appendChild(Child1);
	
	var Child2=document.createElement("DIV");
	Child2.style.width=width;
	Child2.style.height=height;
	Child2.style.border="1px solid red";
	Child2.style.float="left";
	topDiv.appendChild(Child2);
	holder.appendChild(topDiv);
	return {
		SetPosition:function(count){
			if(count>SlideCount)
			{
				count=SlideCount;
			}
			else if(count<0)
				count=0;
			currentPos=count;
			var left=Math.round(count*(width/SlideCount));
			var right=width-left;
			Child1.style.width=left;
			Child2.style.width=right;
		},
		GetPosition:function(){
			return currentPos;
		}
	}
}
var cross;
window.onload=function()
{
	cross=Slide(document.querySelector("body"),200, 10, 100);
	cross.SetPosition(0);
}
</SCRIPT>
<BODY>
<INPUT onclick="cross.SetPosition(cross.GetPosition()+1);" type='button' value="++">
<INPUT onclick="cross.SetPosition(cross.GetPosition()-1)" type='button' value="--">
</BODY>
</HTML>
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

PHP has nothing to do here. What you need to do is using XHRv2, which has an event that reports the progress of a file upload.

You'll find more information here http://www.html5rocks.com/en/tutorials/file/xhr2/[^].
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100