upload_dir based on a record field (e.g. document number)?

Questionsupload_dir based on a record field (e.g. document number)?
Gustavo asked 4 months ago

Hello, I’m using
$col["upload_dir"] = "temp";
to define where uploaded files should be stored.
However, what I need is for the file to be saved inside a dynamic subfolder, which should be created automatically if it doesn’t exist.
This subfolder should be named after the document number of the current record (for example: temp/12345678/).
How can I use a variable like $numeroDocumento inside upload_dir so that each file is saved in its corresponding folder?

1 Answers
Abu Ghufran Staff answered 4 months ago

You can use on_insert or on_update event handler and relocate the file from the base location inside the on insert process.

You can refer to the code: https://www.gridphp.com/demo/demos/editing/file-upload.phps

line 153-155 and 162-182

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

7 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?