在对 php.ini 进行了一系列更改后,我正在尝试进行 upload_progress 会话,例如:
session.upload_progress.enabled = On
;session.upload_progress.cleanup = On
session.upload_progress.prefix = "upload_progress_"
session.upload_progress.name = "123"
session.upload_progress.freq = "1%"
session.upload_progress.min_freq = "1"
并创建了基于 html 的页面,其中包含提交文件的表单:
<form action="upload_progress.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="123" />
<input type="file" name="file1" />
<input type="file" name="file2" />
<input type="submit" />
</form>
然后是正确上传文件的服务器端脚本:
session_start();
move_uploaded_file($_FILES['file1']['tmp_name'], './uploads/'.$_FILES['file1']['name']);
move_uploaded_file($_FILES['file2']['tmp_name'], './uploads/'.$_FILES['file2']['name']);
print_r($_SESSION);
$_SESSION
尽管文件上传正确完成,但全局变量中有一个空数组。会话设置有什么问题?
我正在使用PHP 5.4.5
Notice: Undefined index: upload_progress_123 in C:\apache\localhost\www\upload_progress.php on line 13