我如何通过Php取得进展吧 [英] How Can I Make Progress Bar By Php

查看:46
本文介绍了我如何通过Php取得进展吧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ajax和jquery创建了多个文件上传。我想要一个进度条。但我不知道怎么样,谁能以这种方式帮助我?

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?

推荐答案

它不是PHP解决方案,Javascript。试试下面的内容,你可以正确修改它来使用

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>


您好,



看看这里:

http://www.sanwebe.com / 2012/05 / ajax-image-upload-with-progressbar-with-jquery-and-php [ ^ ]

http://www.w3bees.com/2013/10/file-upload-with-progress-bar.html [ ^ ]
Hi,

Have a look here:
http://www.sanwebe.com/2012/05/ajax-image-upload-with-progressbar-with-jquery-and-php[^]
http://www.w3bees.com/2013/10/file-upload-with-progress-bar.html[^]


PHP在这里无关。您需要做的是使用XHRv2,它有一个报告文件上传进度的事件。



您可以在这里找到更多信息http://www.html5rocks.com/en/tutorials/file/xhr2/ [ ^ ]。
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/[^].


这篇关于我如何通过Php取得进展吧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆