我有一個關於笨,爲什麼我有do_upload缺少參數問題excel文件,在本地主機上它的工作,但拷貝到Linux服務器後,有錯誤是這樣的:笨do_upload缺少參數1 Ubuntu的服務器上
遇到PHP錯誤嚴重性:警告消息:缺少 參數1 for chapter :: do_upload,在 /var/www/html/myfolder/application/controller/chapter.php調用第19行 和定義的Filename:contollers/chapter.php行號:32
我在這段代碼上想的是什麼?
這裏是我的視圖代碼:
<center>
</br>
</br>
<?php echo form_open_multipart('chapter') . "\n"; ?>
<table>
<tr>
<td><input type="file" id="file_upload" name="userfile" size="20" /></td>
<td valign="top" >
<?php echo form_submit('submit', 'Upload'); ?></td>
</tr>
</table>
<?php echo form_close(); ?>
<?php
if ($this->session->flashdata('msg_excel')){
?>
<div class="msg"><?php echo $this->session->flashdata('msg_excel'); ?></div>
<?php } ?>
</br>
</br>
</div>
</center>
mycontoller:
<?php
class Chapter extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('Querypage');
$this->load->model('m_login');
$this->load->helper(array('form', 'url', 'inflector'));
$this->load->library('form_validation');
}
public function index()
{
if ($this->input->post('submit'))
{
$this->do_upload();
$this->load->view('chapter');
}
else
{
$this->load->model('m_jadwal','',TRUE);
$user = $this->session->userdata('username');
$data['pengguna'] = $this->m_login->dataPengguna($user);
$data['kdsmtaktif'] = $this->m_login->smtaktif();
$this->load->view('aka_v', $data);
$this->load->view('chapter');
}
}
public function do_upload()
{
$config['upload_path'] = './temp_upload/';
$config['allowed_types'] = 'xls';
$this->load->library('upload', $config);
if (! $this->upload->do_upload())
{
$data = array('error' => $this->upload->display_errors());
$this->session->set_flashdata('msg_excel', 'Gagal Memasukkan data. Cek file anda, hanya .xls yang diperbolehkan.');
}
else
{
$data = array('error' => false);
$upload_data = $this->upload->data();
$this->load->library('excel_reader');
$this->excel_reader->setOutputEncoding('CP1251');
$file = $upload_data['full_path'];
$this->excel_reader->read($file);
error_reporting(E_ALL^E_NOTICE);
// Sheet 1
$data = $this->excel_reader->sheets[0] ;
$dataexcel = Array();
for ($i = 8; $i <= $data['numRows']; $i++) {
if($data['cells'][$i][1] == '') break;
$dataexcel[$i-1]['data1'] = $data['cells'][$i][1];
$dataexcel[$i-1]['data2'] = $data['cells'][$i][2];
$dataexcel[$i-1]['data3'] = $data['cells'][$i][3];
}
//cek data
$check= $this->Querypage->search_chapter($dataexcel);
if (count($check) > 0)
{
$this->Querypage->update_chapter($dataexcel);
// set pesan
$this->session->set_flashdata('msg_excel', 'update data success');
}else{
$this->Querypage->insert_chapter($dataexcel);
// set pesan
$this->session->set_flashdata('msg_excel', 'inserting data success');
}
}
echo " <script>
history.go(-2);
</script>";
}
}
?>
如何修復,什麼是標籤,如果你不使用它,我必須刪除 – 2014-11-25 04:47:52
要麼改變'公共職能do_upload($用戶,$ kdsmt)'來'公共職能do_upload()' .. – 2014-11-25 04:54:40
但它仍然有同樣的錯誤,像我的問題 – 2014-11-25 06:16:07