PHP有办法实现文件上传进度条吗? 有的,用php的socket实现,具体方法和实现如下:http://www.ugia.cn/?p=54 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 test.php<?phpset_time_limit(0);ob_end_clean();include'progress_bar.php';$maxlen=10;$bar=new progress_bar;$bar->Init();for($i=1;$i<=$maxlen;$i++){ sleep(1); $bar->set_percent($i,$maxlen); flush();}?>---------------------------------------------------进度条类progress_bar.php<?phpclass progress_bar{ var $name; var $percent; var $width; function Init($name = 'pbar',$percent = 1,$width = 277,$auto_create = TRUE) { $this->name = $name; $this->percent = $percent; $this->width = $width; if($auto_create) { $this->create(); } } function create() { ?> <div align="center"> <center> <table height="8" name="<? echo('table_' . $this->name);?>" border="0" style="border:1px solid #545454" cellpadding="0" cellspacing="0" width="<? echo($this->width);?>"> <tr> <td name="<? echo('cell_' . $this->name);?>" align="left" width="<? echo($this->width);?>"><img name="<? echo($this->name)?>" border="0" src="http://www.eyhc.net/cache/img/bar.gif" width="<? echo(($percent * .01) * $this->width);?>" height="8"></td> </tr> </table> </center> </div> <? } function set_percent($cur_amount,$max_amount) { $this->percent = ($cur_amount / $max_amount) * 100; echo('<script>document.images.' . $this->name . '.width = ' . ($this->percent / 100) * $this->width . '</script>'); }}?> 上面那个需要服务器有其它端口开放,一些共享空间无法使用这里也可以看一下,用perl实现上传部分,其它都用phphttp://www.raditha.com/megaupload/目前在用它www.sf.net还有一些,可以看看 不可以!asp、perl可以轻松实现php代劳的太多了换句话说,如果php不直接支持文件上传的话。也可以很轻松的实现不知道你喜欢什么样的处理文件上传的方式1、判断上传的文件的有效性后用拷贝函数复制,但失去建造“进度条”的可能2、自己书写代码分析http协议头,从中过滤出上传文件的信息,然后写入到文件。在此过程中嵌入建造“进度条”的代码 在网上超过10M的内容用Http上传意义就不大了,实际上2M的东西都不想用网页传内网可以玩玩 超过500k的都不想了。http上传是要占着apache一个进程的。真是浪费。 页面在ie下空白火狐下正常 求解 session问题 字符截取。。 简单解析这段php代码 怎么回事? php程序怎么和javascript程序结合?谁知道相关的书籍或有介绍的网站?(回复给分) php如何禁止页面缓存? 为什么?在ie5中提交表单时,提交到一个iframe中时,却在新窗口打开. 请教有关图像问题 哥们兄弟来了公司要用PHP做开发了唉来者有分送 公式的研究,数学好的进---没有积分了,请见谅 在线等,一个php的Cookies问题,解决马上给分!
set_time_limit(0);
ob_end_clean();
include'progress_bar.php';
$maxlen=10;
$bar=new progress_bar;
$bar->Init();
for($i=1;$i<=$maxlen;$i++){
sleep(1);
$bar->set_percent($i,$maxlen);
flush();
}
?>
---------------------------------------------------
进度条类progress_bar.php<?phpclass progress_bar
{
var $name;
var $percent;
var $width; function Init($name = 'pbar',$percent = 1,$width = 277,$auto_create = TRUE)
{
$this->name = $name;
$this->percent = $percent;
$this->width = $width;
if($auto_create)
{
$this->create();
}
} function create()
{
?>
<div align="center">
<center>
<table height="8" name="<? echo('table_' . $this->name);?>" border="0" style="border:1px solid #545454" cellpadding="0" cellspacing="0" width="<? echo($this->width);?>">
<tr>
<td name="<? echo('cell_' . $this->name);?>" align="left" width="<? echo($this->width);?>"><img name="<? echo($this->name)?>" border="0" src="http://www.eyhc.net/cache/img/bar.gif" width="<? echo(($percent * .01) * $this->width);?>" height="8"></td>
</tr>
</table>
</center>
</div>
<?
}
function set_percent($cur_amount,$max_amount)
{
$this->percent = ($cur_amount / $max_amount) * 100;
echo('<script>document.images.' . $this->name . '.width = ' . ($this->percent / 100) * $this->width . '</script>');
}
}?>
http://www.raditha.com/megaupload/
目前在用它www.sf.net还有一些,可以看看
asp、perl可以轻松实现
php代劳的太多了换句话说,如果php不直接支持文件上传的话。也可以很轻松的实现不知道你喜欢什么样的处理文件上传的方式
1、判断上传的文件的有效性后用拷贝函数复制,但失去建造“进度条”的可能
2、自己书写代码分析http协议头,从中过滤出上传文件的信息,然后写入到文件。在此过程中嵌入建造“进度条”的代码
内网可以玩玩