Ala*_*irC 4 php post codeigniter http-post
我正在使用Plupload来管理我网站的文件上传.当我将Plupload配置为发布到以下测试文件时,记录会正确显示,但是当我发布到CI控制器时,$ _POST AND $ _FILES都是空的.
test.php的
<?php print_r($_FILES); print_r($_POST); ?>
Run Code Online (Sandbox Code Playgroud)
CI在使用标准HTML表单时确实正确显示$ _FILES和$ _POST数组,所以任何想法是什么导致了这个?
这里编辑的是plupload配置
var uploader = new plupload.Uploader({
runtimes : 'html5,html4,flash,silverlight,browserplus',
browse_button : 'pickfiles',
container : 'container',
max_file_size : '15mb',
url : '/test.php',
//url : '/upload/do_upload/',
flash_swf_url : '/js/plupload/plupload.flash.swf',
silverlight_xap_url : '/js/plupload/plupload.silverlight.xap',
filters : [
{title : "Documents", extensions : "pdf,doc,docx,rtf,txt"}
],
multipart_params : { job : -2 }
});
Run Code Online (Sandbox Code Playgroud)
这是控制器
class Upload extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$this->load->view('upload_form', array('error' => ' ' ));
}
function do_upload()
{
print_r($_POST);
print_r($_FILES);
$config['upload_path'] = 'incoming/';
$config['allowed_types'] = 'pdf|doc|docx|rtf|txt';
$config['max_size'] = '900';
$this->load->library('upload');
$this->upload->initialize($config); // MUST CALL ELSE config not loaded
if ( ! $this->upload->do_upload()) {
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else {
$data = array('upload_data' => $this->upload->data());
$this->load->model('translation_model');
$this->translation_model->add_orig($job, $filePath);
$this->load->view('upload_success', $data);
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9378 次 |
最近记录: |