Skip to profile content
Hello @ankitl and welcome to our new forums :hugs: Have you checked the video that I’ve created? [Common mistakes when we install Grocery CRUD (part 1)] It pretty much explains how to debug your issue
Am glad you were able to fix that.. GroceryCrud is very simple to use once you get used to its structure.. Good luck.
This is what I was trying to say.. In all cases, if you see it much complicated, keep all your files in a single upload directory, and add the year to the file name.. Example : ‘../uploads/2021_filename.pdf’ This way, all your files will be in a single directory
@cbabekos Thank you.. Can you please post what you tried so far (code).. Your post is not very clear…
Hello @cbabekos , I think the best solution is to store the info about the year that this photo was updated on the database. You can keep the date('Y') only for the insert, for example: if ($crud->getState() === 'add') { set_field_upload(‘file_url’,‘assets/uploads/files/’.date(‘Y’)); } else if ($…
If I understand you well, you should save the folder name for each upload file, as a field in your database. Create a new column in the database, call it ‘file_folder’ for example. When you are saving the record, save the date(‘Y’) i.e. 2021 in that record. And keep the record hidden in grocerycr…
What I am trying to say though is that you don’t need to lose the folder if this is stored in the database as a row for every entry really :slight_smile: For example you can use: callback_after_insert to insert in the row to a field the upload_year and use it this way: if ($crud->getState() === 'add') { set_fi…
Then you can use the callback_column and do not use the set_field_upload on the list state. For example something like this: if ($crud->getState() === 'list' || $crud->getState() === 'ajax_list') { $crud->callback_column('file_url', function () { return "<a href='/assets/uploads/files/{$row->u…