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