uploadprogress模块
实现方法: 使用PECL模块安装
方法安装该模块
PHP.ini里面设置uploadprogress.file.filename
template=“/tmp/upd%s.txt”
代码范例:
<div class="codetitle">
<a style="CURSOR: pointer" data="61579" class="copybut" id="copybut61579" onclick="doCopy('code61579')"> 代码如下: <div class="codebody" id="code61579">
if($_SERVER['REQUEST_METHOD']=='POST'){
if(is_uploaded_file($_FILES['upfile']['tmp_name'])){
$upload_dir='your_path/';
$ext=strrchr($_FILES['video']['name'],'.');
$sessid=$_POST['UPLOAD_IDENTIFIER'];
$tmpfile=$upload_dir.$sessid;
$sessfile=$upload_dir.$sessid.$ext;
if(move_uploaded_file($_FILES['upfile']['tmp_name'],$tmpfile)){
//
上传成功
}else{
//
上传失败
}else{
//
上传错误 }elseif(!empty($_GET['sessid'])){
header("Expires:Mon,26Jul199705:00:00GMT");
header("Last-Modified:".gmdate("D,dMYH:i:s")."GMT");
header("Cache-Control:no-store,no-cache,must-revalidate");
header("Cache-Control:post-check=0,pre-check=0",false);
header("Pragma:no-cache");
header("Content-Type:text/html;charset=UTF-8"); $unique_id=$_GET['sessid'];
$uploadvalues=uploadprogress_get_info($unique_id); if(is_array($uploadvalues)){
echojson_encode($uploadvalues);
}else{
//读取进度失败,另外处理逻辑
} }else{
//
显示上传表单
}