Topic: Save a file in a separate folder

Can anyone show an example of how to save a file in a separate folder instead of a database?
How to link a file to a database?
Thanks in advance.

2 (edited by derek 2020-05-22 16:43:12)

Re: Save a file in a separate folder

Hi Zlaya,
Please have a look at the attached example.
'Screenshot1.jpg' shows the 3 things that need to be set up on your form - 1) the table/field name, 2) the destination of where you want a copy of the file to be saved, which can be wherever you want it to be and 3) specifying the type as 'linkfile' (this means that instead of the file being saved in the database, only the location of the copied file is stored - see 'screenshot2.jpg' which shows what is actually stored in the sqlite.db).
Derek.

Post's attachments

Attachment icon filesave.zip 558.7 kb, 364 downloads since 2020-05-22 

Re: Save a file in a separate folder

Hi, Derek,
Thank you very much.
As always, your explanation is clear and very helpful.
In addition, if I want to make a link to the whole folder containing several things, I should insert it in some zip file first.
Am I correct?
Thanks again.
Regards

Re: Save a file in a separate folder

Hi,
Instead of 'linkfile', can you not just select 'linkfolder' as the 'type' instead?  Or are you meaning something else?
Derek.

Re: Save a file in a separate folder

Hi,

Just to add one question, what is code to open linked folder or file on button click (from this example)?

Thank you in advance Derek.

Re: Save a file in a separate folder

Hello Vladimir,
Please have a look at the attached.
On Form 2, you have the standard icon that you can click to open the folder or file (see screenshot 1.jpg).
Additionally, you can call the linked folder or the linked file separately, using buttons on either Form 1 or Form 2.
You could also open the file by simply clicking in the relevant cell (procedure 'oncellclick') in the tablegrid (when I use this, I add an '*' to the column header to remind the user which columns in the tablegrid have this feature and which columns don't).
Derek.

Post's attachments

Attachment icon filesave.zip 854.71 kb, 333 downloads since 2020-07-07 

Re: Save a file in a separate folder

That's exactly what I needed.

Thanks Derek.

Re: Save a file in a separate folder

Hi, Derek,
Thanks for your example.
It is very useful.
Just one more thing.
If I click to X button in form1 to delete the highlighted file, this action will delete a file from the database only, not from "files".
What should be added to delete the selected file in "files" at the same time?

9 (edited by derek 2020-07-08 10:36:53)

Re: Save a file in a separate folder

Hi Zlaya,
Try it like this;  the extra bits in the script allow for a record to have an existing file replaced by another file (so you need to delete the old file but not the record);  if that's never going to happen in your situation, then you can cut out those sections of the code.
Derek.

Post's attachments

Attachment icon delete from linked folder.zip 347.23 kb, 317 downloads since 2020-07-08