hello panosv ,
I have made a function
public function doc_inc() {
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('docs');
//$crud->set_relation('doc_type','docs','doc_type');
$crud->columns('date','doc_type','protocol_id','date_ap','sender_rcver','email_s_r','subject','assignment','email_assignment','recipient','recipient_email','sender_id','file_url');
…
/* resend document */
$crud->add_action(’’,’’,‘main/resendmail’,‘fa fa-envelope-o fa-2x’,’’);
/*$this->db->select('folder_file');
$this->db->where('id', 239);
$q = $this->db->get('docs');
$row = $q->row();*/
//$crud->callback_before_upload(array($this,'get_folder'));
$path = '/assets/uploads/files/'.**date('Y')**;
if (!is_dir($path)) {
$crud->set_field_upload(‘file_url’,‘assets/uploads/files/’.date(‘Y’));
//$crud->set_field_upload(‘file_url’,$this->verify_path_callback($path));
$crud->set_field_upload(‘zip_file_attach’,‘assets/uploads/files/’.date(‘Y’));
}
//$crud->add_action(‘Project_Details’, ‘’, ‘’,‘ui-icon-plus’,array($this,‘get_id’));
//$crud->add_action(‘Project_Details’, ‘’, ‘examples/proj_details’,‘ui-icon-plus’);
$output = $crud->render();
if ( $this->session->userdata('is_authenticated') ){
$this->_example_output($output);
}else {
redirect('Main');
}
}
}
so code with bold is where i have a problem. I have a list with data and a field to upload a file.
as you can see i have define the function set_field_upload(‘file_url’,‘assets/uploads/files/’.date(‘Y’));
I use date(‘Y’) to set the name of the folder where I have uploaded the file. the problem is that when the year will be changed (2022) I would lose the link to the files inside the 2021 folder.
Follow?
I have created a column inside the database named folder_file eg. 2021
so how can I get the folder_file and set it for each record ?