2012-07-20 103 views
1

我有一个运行codeigniter的imagehost样式网站,我试图使用APC在文件上传时显示进度条。APC fetch返回null,codeigniter进度条

现在,当我访问进度视图页面或通过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请求进度视图每一秒的窗体页上:

http://pastebin.com/6QW3sZLz

有人能看到我可能是做错了什么?感谢

而且,这里是由的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

以及这看起来我错了

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(); 

应该给你输入字段的值。

+0

我只是做了该编辑和/前进/ *键* 返回布尔(假)还是:/ 编辑:只是想你现在的JS改变...... – 2012-07-20 19:51:36

+0

你可以忽略我已经硬编码的关键在JS pastebin中,它实际上设置为PHP中的progress_key值,只是硬编码以显示在示例中。 我甚至在上传页面的某个键上试过硬编码,测试结果相同。 – 2012-07-20 19:55:16