0

这是表格的类型等

<?php
echo form_open_multipart("/Register/registerformModel",array("name"=>"subform2","id"=>"subform2"));
?>

输入类型

<input name="profile" id="profile" type="file" class="input"/>

功能

 $this->load->library('upload');   
 $config['upload_path'] = $this->config->item('upload_url_path').'images/member/';
 $config['allowed_types'] = 'pdf|doc';
 $config['max_size']    = '0';
 $config['profile_name'] = date('Ymd_his_').rand(10,99).rand(10,99).rand(10,99);
 $this->load->library('upload', $config);
 if ( ! $this->upload->do_upload('profile'))
 {
 $data['upload_data']['profile_name'] = '';
 echo $this->upload->display_errors('<p style="color:#FF0000;">','</p>');                   
 }
 else
 {
 $data = array('upload_data' => $this->upload->data('profile'));
 }
 $data['query'] = array(
        'profile' => $data['upload_data']['profile_name']
        );  
        $this->session->set_userdata($data['query']);
        $num = $this->common_model->insert('member',$data['query']);

无法使用此代码上传 PDF/DOC?有谁能够帮我??

4

0 回答 0