⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

problem with custom upload file path in list



davider
  • profile picture
  • Member

Posted 26 April 2013 - 11:44 AM

Hi,

 

i have a problem with file upload:

i set custom file path for add state like this:

$crud->set_field_upload('filename','assets/uploads/'.date('Ymd'));

and i save this path in record_file_path field in my db;

while for edit state file path is set like this:
$crud->set_field_upload('filename','assets/uploads/'.$result->record_file_path);

 

where $result->record_file_path comes from db query with where condition "pkey = $state_info->primary_key"

 

I have two questions:

1 - why in edit state the files that i upload are saved in 'assets/uploads/'.date('Ymd') directory instead of path recovered from my db record?

2 - in list state i cannot see any iimage thumbnails because filepath are set just once and are all the same and of course they are all wrong: can i set correct file paths for each of my records?

 

Thank you very much for hemlping me.

Davide.


davider
  • profile picture
  • Member

Posted 26 April 2013 - 13:14 PM

I solved second problem with callback_column function.

 

Any idea for the first one?


davider
  • profile picture
  • Member

Posted 26 April 2013 - 14:53 PM

I solved first problem too:

when I click on "upload a file" the state changes from edit to upload_file: this means I have to set again my upload_path;

moreover, since $state_info->primary_key is now empty, I have to save my element pkey in flashdata session and preserve it in order to be able to recover it throughout all my uploads.

 

I hope this will help people with same problem.

 

Bye.

Davide.