Vuejs File Type extension Validation

Today, We want to share with you Vuejs File Type extension Validation.In this post we will show you validate files in laravel using vue.js, hear for How to check if file type is a specified file type(Image) in vue.js? we will give you demo and example for implement.In this post, we will learn about VueJS – Validate file size requirement in form file upload with an example.

Vuejs File Type extension Validation

There are the Following The simple About Vue-js File Type extension Validation Full Information With Example and source code.

As I will cover this Post with live Working example to develop VeeValidate(vue.js) image file size and dimensions validation, so the VueJS – Validate file size requirement in form file upload for this example is following below.

File type

app.vue




VueJS – Validate file size

vuejs Part

new Vue({
  el: '#app',
  methods: {
    onSubmit(e) {
      const file = this.$refs.file.files[0];
      
      if (!file) {
        e.preventDefault();
        alert('No file chosen');
        return;
      }
      
      if (file.size > 1024 * 1024) {
        e.preventDefault();
        alert('File too big (> 1MB)');
        return;
      }
      
      alert('File OK');
    },
  },
});

HTML part



if(files[0]['type']==='image/jpeg')
Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Vue 2.0 File Type extension vee Validation.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment