我有一个运行codeigniter的imagehost样式网站,我正在尝试使用APC实现进度条,以便在文件上传时显示。
现在,当我访问进度视图页面或通过ajax时,它只是返回bool(false)
。
我已经测试apc_store
并在该视图中获取以查看APC是否正常运行,并且这种方式有效,但我的上传形式似乎不适用于APC。
我的进度视图(domain.com/progress/KEY)http://pastebin.com/m2qF1BEw
我在控制器中的progress()
:
function progress() {
$this->load->model('Site_model');
$data['PROGRESS_KEY']= $this->input->post('progress_key');
$this->load->view('progress', $data);
}
我的上传页面视图中设置的密钥:
$up_id = md5(uniqid(rand()));
我的上传页面视图中的表单:
<form action="http://domain.com/site" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<input type="hidden" name="APC_UPLOAD_PROGRESS" value="a1105b41e90ed6cdaa7bdef008da40ee" id="progress_key" />
<input type="file" name="userfile[]" value="" multiple="multiple" id="file" accept="image/*,application/pdf" />
<input type="submit" name="upload" id="upload" />
</form>
<iframe id="upload_frame" class="nodisplay" name="upload_frame" frameborder="0" border="0" src="" scrolling="no" scrollbar="no" > </iframe>
这是表单页面上每秒请求进度视图的JS:
任何人都可以看到我的错误吗?谢谢
此外,这是phpinfo()
确认的所有apc php.ini设置apc.cache_by_default On On
apc.canonicalize On On
apc.coredump_unmap Off Off
apc.enable_cli On On
apc.enabled On On
apc.file_md5 Off Off
apc.file_update_protection 2 2
apc.filters no value no value
apc.gc_ttl 3600 3600
apc.include_once_override Off Off
apc.lazy_classes Off Off
apc.lazy_functions Off Off
apc.max_file_size 30M 30M
apc.mmap_file_mask no value no value
apc.num_files_hint 1000 1000
apc.preload_path no value no value
apc.report_autofilter Off Off
apc.rfc1867 On On
apc.rfc1867_freq 10k 10k
apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
apc.rfc1867_prefix upload_ upload_
apc.rfc1867_ttl 3600 3600
apc.serializer default default
apc.shm_segments 1 1
apc.shm_size 32M 32M
apc.slam_defense On On
apc.stat On On
apc.stat_ctime Off Off
apc.ttl 7200 7200
apc.use_request_time On On
apc.user_entries_hint 4096 4096
apc.user_ttl 7200 7200
apc.write_lock On On
答案 0 :(得分:0)
这对我来说是错误的
function progress() {
$this->load->model('Site_model');
$data['PROGRESS_KEY']= $this->input->post('progress_key'); // error here
/* above you fetch "progress key" should change to APC_UPLOAD_PROGRESS */
$this->load->view('progress', $data);
}
并在此输入字段中名称为APC_UPLOAD_PROGRESS,您正在获取ID
<input type="hidden" name="APC_UPLOAD_PROGRESS" value="a1105b41e90ed6cdaa7bdef008da40ee" id="progress_key" />
你javascript看起来还不错,但你没有得到当前值,你手动设置它。
$("#progress_key").val();
应该给你输入字段的值。