Copy download file from other table

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
meickert
Posts: 15
Joined: 2016-06-24 23:05

Copy download file from other table

Post by meickert » 2021-04-12 11:33

Hi there,
my AG-App has 2 tables. One is for working - the other only contains templates for table1.

When I click on "use template" in table1 it opens a dropdown with the datasets from table2

Selecting a dataset in table1 copies (all) fields from table2 to table1 on saving (before insert). If no template is used the ckeckbox for "use template" is set to hidden on saving.That all works fine.... but...

Table2 has a upload-file-field. Table1 has a download-link-field.

When copying a template from table2 to table1 the upload-link in table2 should be copied to the download-link-field in table1.

Trying this the database shows me:
table1.download = test.pdf
and
table2.upload = test.pdf

So it seems to work. But....

when I click on the "uploaded-file-link" in table2 it opens: http://localhost/images/test.pdf
clicking on the download-link it opens: http://localhost/test.pdf instead.

So: How can I make every download work like the upload-file-link and always "append" the folder "images" before the filename?

Thanks for your help and sorry for my english :)
Marcus

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Copy download file from other table

Post by onoehring » 2021-04-12 12:57

Hi Marcus,

is the field type (setting in AG) for table2.upload set to "file"? I assume, that only if this is set to file (not text) the /images folder will be used as a prefix.

Olaf

Post Reply