is there a way to use the old grocerycrud with php8.3 and ci3 ? i have a project that i have to build from scratch using ci4 and grocery crud 2.x (not enterprise) . can you propose a way. ? however if i want to build it in ci4 should i use the gc2.x? Version for free?
hello , sir ,
did you fix the problem you have dealing with ?
if yes can you tell me the solution to your problem because I am dealing with the same when I am trying to
upload a file to a specific folder but when I define the set_field_upload with my path, the function uses the default path , not…
The path that i want to upload the file is the assets/uploads/files/2021 but when i use a query to get the database field and append it to assets/uploads/files/'.$file_folder of set_field_upload argument, when i am trying to upload a file , the function uses the default upload_dir which is assets/up…
hello dear members,
i saw this problem with file size and set_field_upload.
Can you help me with that function? i don’t understand why when I set the function
set_field_upload(‘file_url’,‘assets/uploads/files/’.date(‘Y’) ); on edit state , it works fine. However ,
when i changed the date(‘Y’) wi…
hello again,
may i revive this post and i would like to ask , inside getState==edit how can i get a database field ? to
add it on set_field_upload function.
inside controller i create a function to get the folder name and i call it inside edit like this :
} else if ($crud->getState() == 'edit')…
Hello panv ,
yes, I didn’t find full solution about this.
I had to attend to other issues from other applications.
I solved it but I have another issue with state == edit
i have opened a new post :
if you can sneak a peek with this … i have posted segments with my code…
thank you in advance.
this is two independent if for getState == edit
this is not right?
if ( $state == 'edit'){
$dc = $this->_get_doc_type($info->primary_key);
$this->session->set_userdata('doc_type',$dc);
......
} // end if state
and a few lines below i use it again… i cant ?
hello mariel_alberto ,
here is the code from this function :
skip comments.
public function doc_inc()
{
//$value_i = $this->mymodel->testing();
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('docs');
//$crud->set_relation('doc_type','docs','doc_type…
hello mariel_alberto
this functions import the path of upload files in different folders on list mode.
e.g. if we have a folder with the year (2021) and upload files there. if the year has changed (2022) we will lose the connection with older files … so with this function we are setting the path f…
I had removed the second getState() but nothing.
the structure I think is not so bad.
I am getting the state first and after that check with if then else the content of this value is edit.
The var dump value has the value ‘edit’ so if if you click to edit, the state value gets the value ‘edit’. A…
this is the full code of my controller !
public function doc_inc()
{
//$value_i = $this->mymodel->testing();
$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…
hello again … ,
i dont understand why the if ( $state == ‘edit’ ) is not working right.
I made the changes as you said but nothing ..
i have another getState() few lines before for other reason
but i dont think that is problem …
i dont understand why set_field_upload getting the default path … …
hello panv,
i have written this code :
if ( $state == 'edit') {
$pkey = $info->primary_key;
$this->db->where('id', $pkey);
$q = $this->db->get('docs');
$r1 = $q->row();
$p1 = 'assets/uploads/files/'.$r1->folder_file;
$_SESSION['p']=$p1;
…
i found a solutions about allowed file types per field !
but i have another problem.
I defined this function :
function _callback_before_upload($files_to_upload,$field_info){
/*debug code */
//$_SESSION['pkey'] = $pkey;
$_SESSION['files_to_upload'] = $files_to_upload;
$_SESSION['field_na…
i dont understand !
the function set_upload_field(‘field’,‘assets/files/upload’, ‘pdf’)
but i debug code :
public function set_field_upload($field_name, $upload_dir = ‘’, $allowed_file_types = ‘’)
{
$upload_dir = !empty($upload_dir) && substr($upload_dir,-1,1) == ‘/’
? substr($upload_dir,0,-1)
: …
I found this on git
and as you can see there is a reference to set_field_upload( 1 argue, 2 argue, there is a 3rd argument)
if you will see inside lib/grocery_crud there is this :
header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
$allowed_files = $this->config->f…
can I ask another issue with set_field_upload('field', 'path file upload', 'set file types')
I see that inside grocery crud lib there is another argument for this function that defines what file types allowed.
I tried to set a file type(e.g pdf) but is not working.
Indeed! it is the best framework ! I am going to buy the enterprise edition later which is built with Zend framework !
It was so easy thinking the callback_column ! I have used this function elsewhere!
Thank you for you help !!
i define this function inside controller
$crud->callback_column('file_url',array($this,'_callback_upload_field'));
and create this
public function _callback_upload_field($value, $row)
{
return “<a href='”.site_url(‘assets/uploads/files/’.$row->folder_file).“/”.$row->f…
I try to get the primary key on list mode and get from each row the field folder (eg. 2021)
and define the $folder
set_field_upload('file_url','assets/uploads/files/'.$folder);
$state = $crud->getState();
$state_info = $crud->getStateInfo();
if ( $state === 'list'){
$primary_key = $state_info->primary_key;
}
i wrote this but i get this error !
Severity: Notice
Message: Undefined property: stdClass::$primary_key
Filename: controllers/Documents.php
Line Number…
I don’t want to get the folder_year on edit
I want to get it on the list and put it on each link
set_field_upload(‘file_url’,‘assets/uploads/files/’ . $photoYear);
This function is used to set the path for the upload file. I build the path ‘assets/uploads/files/’.date(‘Y’)
I could replace date(‘Y’) with text ‘2021’ . I did that thinking when the year changed , I will create the new folder for the new year but that’s the problem . when I create the new folder…
how can i explain it better!
we have a list of records ok ?
between the database fields we have a file_url field where we can save file like a pdf file. clear so far ?
now . I define the function ```
set_field_upload(‘file_url’,‘assets/uploads/files/’.date(‘Y’)); // location for upload file an…
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','su…