php上传进度条。之前做了上传了,正常上传。现在要做进度条。怎么做?不要做假的,要真实的

2025-03-23 23:49:33
推荐回答(2个)
回答1:

更新你的php到5.4以上
你会用到这个的:Session Upload Progress ,php自带的会话上传进度
php会话进度********************
session_start();
$key = ini_get("session.upload_progress.prefix") . ini_get("session.upload-progress.name");
var_dump($_SESSION[$key]);
?>
表单********************


" value="123" />




应用示例********************
$_SESSION["upload_progress_123"] = array(
"start_time" => 1234567890, // The request time
"content_length" => 57343257, // POST content length
"bytes_processed" => 453489, // Amount of bytes received and processed
"done" => false, // true when the POST handler has finished, successfully or not
"files" => array(
0 => array(
"field_name" => "file1", // Name of the field
// The following 3 elements equals those in $_FILES
"name" => "foo.avi",
"tmp_name" => "/tmp/phpxxxxxx",
"error" => 0,
"done" => true, // True when the POST handler has finished handling this file
"start_time" => 1234567890, // When this file has started to be processed
"bytes_processed" => 57343250, // Amount of bytes received and processed for this file
),
// An other file, not finished uploading, in the same request
1 => array(
"field_name" => "file2",
"name" => "bar.avi",
"tmp_name" => NULL,
"error" => 0,
"done" => false,
"start_time" => 1234567899,
"bytes_processed" => 54554,
),
)
);

回答2:

http://www.cnblogs.com/y0umer/archive/2011/08/19/2809614.html 这个上面有例子,你可以产考,希望能帮助到你。