|
本帖最后由 fastammo 于 2015-1-28 16:36 编辑
资料夹权限有设定777,但传不上去,不清楚是哪边出错
view
PHP复制代码
<form id ="frm">
<div class="form">
<table class="form_table2">
<tr >
<th >名字 </th >
<td >
<input name ="name" type ="text" id ="name">
</td >
<th >上傳 </th >
<td >
<input name ="img1" type ="file" id ="img1">
<input name ="img2" type ="file" id ="img2">
</td >
</tr >
</table >
</div >
<div class="btn">
<a class="send">送出 </a >
</div >
</form >
<script type ="text/javascript">
$ (document ).ready (function() {
$ ('a.send').click (function(){
$ .post ('/upload_file/', $ ('#frm').serialize() , function(data ) {
}, 'json');
});
});
</script>
复制代码
controllers
PHP复制代码
function do_upload ()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
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->view('upload_success', $data);
}
$send_data = $this->input->post(NULL, TRUE);
$data = $this->send_model->register_send($send_data );
}
复制代码
|
|