PHP 5.4 引入了一项新功能来跟踪文件上传。这个功能是
$_SESSION上传_进度。
我们必须通过 php.ini 启用它。
虽然我在 php.ini 中找不到任何位置来启用此选项。有什么问题吗?
我的 php 版本是 5.4。
最佳答案
您需要将这些参数添加到您的 php.ini 文件中。
session.upload_progress.enabled = on
session.upload_progress.prefix = "upload_progress_"
session.upload_progress.name = "blabla"
检查这个 <form>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="blabla" />
<input type="file" name="file1" />
<input type="file" name="file2" />
<input type="submit" />
</form>
以及你的 PHP..
<?php
$_SESSION["upload_progress_blabla"] = 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(
这是信息的混合体,也取自 PHP Manual。您需要认真检查一下。
关于在 php INI 中找不到 PHP session upload_progress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23011950/