简体   繁体   中英

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:

An error has occurred on uploading

It gets prompted 2 times in a row from single upload.

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 ? 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:

chmod -R 777 assets/uploads/files
chown -R archie:www-data assets/

" archie " as the user with sudo rights on the system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM