[{TableOfContents }]

!!!ATTACHING FILES

Files can now be attached to any records in two main ways: 
*As binary data in a BLOB column in the database (_DATA)
*Virtual file in the ‘File Attachments’ directory of the server file system.(_FILE)

[AttachingFile_01.jpg] 

!!Professional Implementation (GUI Widget)  
The new Form Input Component (FIC) is a modified text field, which displays 3 components: 
# Name and link to open the attached file. 
# File chooser action button, which allows users to browse and attach a    new file. 
# Delete action button, which allows users to delete the attached file. 

[AttachingFile_02.jpg]
 
*Clicking on the text link once or pressing the <Enter> key will open the stored file using the respective default Windows application. For example, if the stored file is a Microsoft Word Document, Microsoft Word will be launched and will open and display the file.\\  \\ 
*Upon uploading a new file to attach, the FIC will automatically refresh to display the newly uploaded file. Clicking once on the text area will open the uploaded file in the default application viewer. However, this new file will NOT be saved as attached to the record until the form is saved.

!!Add a File Attachment Column to any Table in the Database (Applies for File and Data)
#Users can add a file attachment column to any table in the database. This is an especially powerful feature as users will be able to attach files to any record for any table in the system, regardless of whether or not they were originally intended to hold file attachments. To do this, the user must first create a media code for the file attachment column or use an existing one in [IMEC].\\  \\[AttachingFile_03.jpg]\\  \\ 
#The media code needs to be created for the table for which the file is to be attached. In [IMFDH], the user will need to add 2 form items to represent the new file attachment column as a form item in the form:\\ \\ a) Column with the same column name as the media code.\\  \\b) Column with the same column name as the media code followed by either “_FILE” or a “_DATA”.  Adding the “_FILE” column will save attached files to the server file system while adding the “_DATA” column will upload all attached files to the database in the MEDIA_BLOB column of the Media table.\\  \\[AttachingFile_03.jpg]\\  \\Please note that the form item represented on the form should be the “_FILE” or “_DATA” form items. The other form item should be hidden.\\  \\
#Final result should look like this:\\  \\[AttachingFile_05.jpg]\\  \\

!!Attach Self-Service Implementation (GUI Widget)  

*The new web item displays 2 components:\\a) Name and link to open the attached file.\\b) File chooser action button, which allows users to browse and attach a new file.\\   \\
*Clicking on the text link once will open the stored file in a new browser window.\\  \\ 
*Upon uploading a new file to attach, the FIC will automatically refresh to display the name of the newly uploaded file. 

Example of the set up:

!!Files by Uploading/Downloading Files to/from Server File System (Applies for _FILE only)
File can be attached by uploading the files directly into the server file system. In fact, this is actually currently the most common method used in the system. When a file is attached using this method, it is uploaded to the server in the directory specified by the LOAD_DATA_FOLDER site preference and stored in a folder with the name of the table alias of the table of the record for which it is attached.\\  \\[AttachingFile_09.jpg]

!!Attach Media Files to Table Records 
%%information Professional Implementation Only%%
Users can attach media files to table records via the Media Dialog by clicking on the Show Media button in the form toolbar. In the Media Dialog, the user can insert or update media records associated with the current record in application focus.\\  \\ 
Show Media Dialog From Toolbar button in red box\\
[AttachingFile_10.jpg] 

Media Dialog showing attached media file for the current Sites record\\
[AttachingFile_11.jpg]  

[{If var='loginstatus' contains 'authenticated'

----
![Discussion|Edit:Internal.ATTACHING FILES]
[{InsertPage page='Internal.ATTACHING FILES' default='Click to create a new discussion page'}]

}]