http://127.0.0.1/masterlinkci2/admin/cpages/addpicture/33
上传图片1.jpg并按上传文件后,只出现一个空白的白色屏幕,我想知道为什么?
控制器/ Cpages.php
public function addpicture() {
$gallery_id = $this->uri->segment(3);
$data['images'] = $this->Mpages->call_slideshow($gallery_id);
$this->load->view('addpicture', $data);
}
视图/ addpicture.php
<label><b>UPLOAD PICTURE</b></label><br><br>
<div style="margin-left: 35px">
<fieldset>
<div class="form-group">
<div class="row">
<div class="col-md-12">
<label for="filename" class="control-label">Select File to Upload</label>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-12">
<input type="file" name="filename" size="20" />
<span class="text-danger"><?php if (isset($error)) { echo $error; } ?></span>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-12">
<input type="submit" class="edit" value="Upload File" class="btn btn-primary"/>
</div>
</div>
</div>
</fieldset>
</div>
控制器/ Cuploadfile.php
//file upload function
function uploadgallerypic()
{
//set preferences
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'jpg|gif';
$config['max_size'] = '1000000';
//load upload class library
$this->load->library('upload', $config);
$this->load->model('Mpages');
if (!$this->upload->do_upload('filename'))
{
// case - failure
$upload_error = array('error' => $this->upload->display_errors());
$this->load->view('addpicture', $upload_error);
}
else
{
// case - success
$gallery_id = $this->uri->segment(3);
$upload_data = $this->upload->data();
$filename = $upload_data['file_name'];
$this->Mpages->add_picture_gallery($filename, $gallery_id);
$data['success_msg'] = '<div class="alert alert-success text-center">Your file <strong>' . $upload_data['file_name'] . '</strong> was successfully uploaded!</div>';
$this->load->view('addpicture', $data);
}
}
任何人都可以帮我解决为什么在按下&#34;上传文件&#34;屏幕上出现一个空白的白色屏幕?