Upload an Attachment to a New Record

Code Customization
Upload an Attachment to a New Record (Not Applicable To Mobile)

This customization uploads an attachment such as an image or Microsoft Word document. This customization creates a new database record and uploads a file to a database field of type image (Microsoft SQL Server) or OLE Object (Microsoft Access).

NOTE: The database table must have a primary key. If you want to upload an attachment to a database field, you do not need a code customization to do so. On the Property Sheet, set the Display Style of the Field Value control to "File UpLoad". This code customization provides two additional features: (1) to upload to a new database record and (2) to save the file name in a field.


Step 1:  In Iron Speed Designer, switch to Layout Editor. Select a record panel or table panel.

Step 2:  Select any desired cell, copy the following HTML code into the Cell Editor.

<input type="file" id="inputFile" name="inputFile" runat="server"/>

Step 3:  Drag and drop a Button (Themed) from the Toolbox to a desired cell.

Remember the name of the button because you need to know this to select a value for the button control variable in the Code Customization Wizard.

Step 5:  Set the button text and tool tip text properties for the button in Property Sheet.

Step 6:  Go to Custom attributes in the button's Property Sheet and add "PostBack" pass-through attribute with value "True". Add this attribute only if the button is inside a table or record control whose SmoothPanelUpdate pass-through attribute is true.

Step 7:  Build the application.

Step 8:  Use this wizard to add code that handles the OnClick event for the custom button.

Step 9:  Build and run the application.

Customizations included in this wizard are provided as a sample to demonstrate a feature, and may work only in specific situations. The Iron Speed Designer support team cannot assist in the resolution of problems which may occur as a result of customizing your application or modifying a customization to fit a particular purpose.

Terms of Service Privacy Statement