I am developing a small, internal-use only web application. Given its simple nature and intended audience, I decided that it might be a good opportunity to use a ASP.NET Dynamic Data project to get things up-and-running quickly. So far so good, except for one issue that has me reconsidering the whole plan:
I need to be able to upload files through the website. There is an entity in the model that represents an uploaded file. This entity has properties for the file's contents, the file name, and the file's content type. When uploading a file, all of these values are obtained from a single FileUpload
control.
Since a FieldTemplate
has a one-to-one association with an entity property, I decided that I needed to create a custom EntityTemplate
for the File entity. At this point, I have created an "edit" template for the entity that has a FileUpload
control. What I have not been able to figure out is, when the user clicks the 'Update' link, how do I get the data from the FileUpload
control back into the entity and (ultimately) into the database.
Any advice or guidance is much appreciated.