Vue FileUploader - File Validation
FileUploader allows you to restrict uploaded file sizes and extensions using the following properties:
Define minimum and maximum file sizes in bytes. The following code snippet specifies 1 KB minimum and 1 MB maximum sizes:
App.vue
- <template>
- <DxFileUploader
- :allowed-file-extensions="allowedFileExtensions"
- :min-file-size="1024"
- :max-file-size="1024*1024"
- />
- </template>
- <script setup lang="ts">
- import { DxFileUploader } from 'devextreme-vue/file-uploader';
- const allowedFileExtensions = ['.jpeg', '.png'];
- </script>
FileUploader validates files on the client. You should also validate uploaded files on the server. Refer to the following demo for an ASP.NET server validation example: