Document fields are essential for storing files in your database, and understanding how to configure them effectively can greatly enhance your application's functionality and user experience. In this guide, we will cover the basics of document fields, how to customize their size and allowed extensions, and how they appear and function within an MVC webpage. With the help of visual aids, you will learn how to upload, edit, and manage files within your application.
In the generated webpage, the document field will have this appearance:
To upload a file, the user must click on the 3 dots (...) and select "Attach"
After the user selects a file from the file system, the system will check the file size and extension against the configurations defined for that document field. If the file is too large, the webpage will display an error message saying "File is too large", and if the extension is not allowed, the message will read "File type not allowed". If both the size exceed the maximum defined by the user and the extension is not allowed, the system will display the "File type not allowed" message, due to it being the first condition to be checked.
If the file complies to both conditions, it will be uploaded, and after the upload, the document field changes:
After the upload, it is possible to download the file by clicking the box where the file name is displayed, and if the user clicks the 3 dots (...), it is also possible to perform the download, edit and delete actions, and additionally view the file properties.
The edit action downloads the file, and after editing it, it is possible to submit the changed file (or a different one), making it a versioned document, in which it is possible to view, download and delete different versions. The delete action deletes the file that was uploaded, and the document field becomes empty again. The properties display information about the uploaded file:
In this documentation, we have discussed how document fields store files in the database, how to customize their size and allowed extensions, and how they appear and function within an MVC webpage.
By understanding these concepts, you can effectively manage your application's file storage and provide a seamless user experience. We hope this guide has been helpful in enhancing your knowledge of document fields and their customization, and we encourage you to apply these concepts to your projects.