这是我的代码,我不知道为什么它不起作用我已经有 csv 文件的 mimes.php 我不知道出了什么问题我已经在其他功能中使用了此代码,但在这里它不起作用。
控制器:
function convert_csv(){
$config['upload_path'] = './files/contracts/';
$config['allowed_types'] = 'pdf|csv';
$config['max_size'] = '4096';
$this->load->library('upload', $config);
$this->upload->display_errors('', '');
if ( !$this->upload->do_upload("csvfile")){
$error = array('error' => $this->upload->display_errors('<span>','</span>'));
$this->session->set_flashdata("upload_message", $error);
} else{
$upload_result = $this->upload->data();
}
}
看法:
<?php $form_options = array( 'id' => 'contract_items',
'class' => 'form-horizontal' ); ?>
<?=$this->formbuilder->open( $controller.'/convert_csv/'.$c->id, TRUE, $form_options );?>
<?php echo form_open_multipart('upload/do_upload');?>
Select File To Upload:<br />
<input type="file" name="csvfile" value="csvfile" text="csvfile" />
<br /><br />
<input type="submit" value="Submit" />