[英]Grocery CRUD and Codeigniter upload file not working.
1st.第一。 This is my 1st time using this plugin!这是我第一次使用这个插件!
I created upload field :我创建了上传字段:
$this->grocery_crud->set_field_upload('img_holder','assets/uploads/files');
This is ment for main image of article, but when i press it, i can choose file, it starts uploading and when it comes to 100 % it prompts:这是文章的主图,但是当我按下它时,我可以选择文件,它开始上传,当达到100%时它会提示:
An error has occurred on uploading上传时发生错误
It gets prompted 2 times in a row from single upload.它从单次上传中连续提示 2 次。
Im sure i didn't call same field 2 times as an upload field, and im out of ideas how to fix this, is there some workaround on this ?我确定我没有将同一个字段作为上传字段调用 2 次,而且我不知道如何解决这个问题,是否有一些解决方法? or a fix ?或修复?
this is my whole controller code:这是我的整个控制器代码:
<?php class list_news extends CI_Controller {
function __construct()
{
parent::__construct();
/* Standard Libraries */
$this->load->database();
$this->load->library('session');
$this->load->helper('url');
/* ------------------ */
$this->load->library('Grocery_CRUD');
}
function postovi($output = null)
{
if($this->session->userdata('logged_in'))
{
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
$this->load->view('list_news_view.php',$output);
}
else
{
//If no session, redirect to login page
redirect('login', 'refresh');
}
}
function index()
{
$this->grocery_crud->set_field_upload('img_holder','assets/uploads/files');
$output = $this->grocery_crud->render();
$this->postovi($output);
}
}
?>
If you are using a linux/Ubuntu, do this:如果您使用的是 linux/Ubuntu,请执行以下操作:
chmod -R 777 assets/uploads/files
chown -R archie:www-data assets/
" archie " as the user with sudo rights on the system. “ archie ”作为在系统上具有 sudo 权限的用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.