Adding file support to an Add form is relatively easy. Adding support to an edit form is just slightly more involved.
In this article, we'll walk through what it takes.
There are two significant differences in our field definitions on an edit form compared to the add form.
We do still need the binary image, and we still need the file name. But keep in mind that with an edit form, binary data may already exist. To handle that, you will also need a field that indicates when the file has changed.
Furthermore, we are going to have to tell CRM how to retrieve the image file from the database, using a custom SQL function. Note that the function is required, even if you don't plan to actually download the file from within your form.
Here is an example trio of fields for your edit form:
Make sure to load your spec before moving on to the next step.
Create a UIModel for your edit form (or, if you already have one, use Tools>Refresh UIModel to update it).
Make the following changes to the HTML file:
1) Add the following CSS block to the very top, above everything else:
2) Change the file name field as shown in these before-and-after snippets
Open the .VB or .CS file for your UIModel.
Add a handler for the image 'FileSelected' event. The below example is in VB.
Finally, load your spec, deploy the HTML and DLL, and you should have a fully functional file upload field in your edit form.
Questions? Comments? Please reach out at firstname.lastname@example.org, or via any of the methods on our Contact page.