I prefer storing on disk and keeping path references. I dislike storing lots of attached files in blob fields since this clogs up the database needlessly.
No, it's not only for e-mails. You can use this fct for any files. Make a test : create an interraction (a phone call) and the try to attach to it a Word file.
You could reuse Table 5062 records with Storage Type = Embelled to store your attachments.
Dakkon :
Disk storing is hardware and network definition dependent. If you change somethink (ex : name or path to the file server), you loose all file connexions. Storing in the DB as embelled files could increase the DB size but when you do a backup/restore of the DB, you save also all your attachments, that could be a great advantage.
I weighed up the pros and cons of both options outlined above and decided to implement both.
i.e. I decided that (from previous experience) it easily happens that file paths change and files get deleted from network drives. Disk space is cheap and the type of attachments we are using are rarely over 1 MB in size so now my modifications to the Service module stores attachments in BLOB and also copies the attachment to network drive.
I also found it easier to get my head around retrieving the file from a BLOB than from disk so now when a user wishes to view a file that is already attached it gets that file from the BLOB field.
Answers
This part of code could be reused to attach files to others elements like Customers or Items. With some programming of course ...
This seems to be related to attachments to emails ... I was not specifc enough in my first post.
I meant how can I store a file in a navision table. For example if I wanted to attach a file to an item.
I'm thinking I would create a file attachment table that is linked to the item table.
Then I think have two possible options:
1. store the file in a blob in the table
OR
2. store a path to the file in the table and store the actual file on disk in a local folder.
Which is best or add your own suggestions.
I traded my sanity for a railgun
No, it's not only for e-mails. You can use this fct for any files. Make a test : create an interraction (a phone call) and the try to attach to it a Word file.
You could reuse Table 5062 records with Storage Type = Embelled to store your attachments.
Dakkon :
Disk storing is hardware and network definition dependent. If you change somethink (ex : name or path to the file server), you loose all file connexions. Storing in the DB as embelled files could increase the DB size but when you do a backup/restore of the DB, you save also all your attachments, that could be a great advantage.
I traded my sanity for a railgun
I weighed up the pros and cons of both options outlined above and decided to implement both.
i.e. I decided that (from previous experience) it easily happens that file paths change and files get deleted from network drives. Disk space is cheap and the type of attachments we are using are rarely over 1 MB in size so now my modifications to the Service module stores attachments in BLOB and also copies the attachment to network drive.
I also found it easier to get my head around retrieving the file from a BLOB than from disk so now when a user wishes to view a file that is already attached it gets that file from the BLOB field.
Thanks for help.