This article describes how to add attachments to your service items.
Attachment Function Options
The :file_name option is configured to the name of the file in the attachment directory (see below) to be attached. By default this will also be the name that Kinetic Request uses to refer to the attachment and the name used when the file is copied to the web server. This is required when configuring an attachment.
The :file_alias option specifies another name to use when referring to the attachment within Kinetic Request and also the name used when copying the file to the web server. Note that the file will still be stored in the database with its original name.
The :description option provides a description of the attachment.
When building a service item with attachments, the kurl.jar expects an attachment directory with the same name as the ruby file but without the .rb extension. Example: for a service item definition file named "HardwareRequest.rb" the corresponding attachment directory would be named "HardwareRequest". The attachment directory should be in the same location as the ruby file.
Note that when retrieving service items, the kurl.jar will create the attachment directory automatically if the service item contains attachments.
The same file cannot be uploaded more than once, therefore it is invalid to have two attachments configured with the same :file_name.
Also two attachments cannot be configured with the same :file_alias because there would be a conflict when copying the file to the web server.
attachment :file_name => "styles.css", :type => :stylesheet, :description => "Stylesheet"
This example shows how to add a stylesheet attachment.
attachment :file_name => "request_159.jpg", :file_alias => "logo.jpg", :type => :image, :description => "Image"
This example shows how to add an image attachment. Also note that the :file_alias option is configured. This configures the name that Kinetic Request will refer to the attachment as and also the name of the file when copied to the web server.