Vue js Axios File Upload using PHP

Today, We want to share with you Vue js Axios File Upload using PHP.In this post we will show you Uploading Files With VueJS and Axios, hear for File Upload using Vue js Axios PHP we will give you demo and example for implement.In this post, we will learn about multiple-file-uploads-with-vue js-and-laravel with an example.

Vue js Axios File Upload using PHP

There are the Following The simple About Vue js Axios File Upload using PHP Full Information With Example and source code.

As I will cover this Post with live Working example to develop vue js upload audio, video file, so the axios upload multiple files for this example is following below.

Vue js Axios File Upload using PHP
Vue js Axios File Upload using PHP

Step 1: Include Vue.js library

At first we need to include Vue.js Latest library file.1. Download & Include

<script src="vue.js"></script>
<script src=""></script>

Step 2: JavaScript/jQuery Source Code:

This file All the Data contains the following JavaScript/vuejs Source codes which calls liveServerUpload() method..

var app = new Vue({
  el: '#pakaShop',
  data: {
     file: "",
  methods: {

     liveServerUpload: function(){

       this.file = this.$refs.file.files[0];

       let formData = new FormData();
       formData.append('file', this.file);'do_upload_files.php', formData,
          headers: {
            'Content-Type': 'multipart/form-data'
       .then(function (response) {

             alert('Sorry File not uploaded.');
             alert('Your Vuejs with PHP File uploaded successfully.');

       .catch(function (error) {


Step 3: HTML Source Code:

This file contains the following HTML Markup Source codes.

<div id='pakaShop'>

   <input type="file" id="file" ref="file" />

   <button type="button" @click='liveServerUpload()' >Upload file</button>

Step 4: PHP Source Code

Following PHP Source codes are used for upload file with Vue.js and PHP.



// your uploaded File name
$filename = $_FILES['file']['name'];

// simple assign Valid file extensions
$valid_extensions = array("jpg","jpeg","png","pdf");

// File extension check logic in PHP
$extension = pathinfo($filename, PATHINFO_EXTENSION);

// here Check extension logic in PHP
if(in_array(strtolower($extension),$valid_extensions) ) {

   //PHP To simple Upload file
   if(move_uploaded_file($_FILES['file']['tmp_name'], "uploads/".$filename)){
      echo 1;
      echo 0;
   echo 0;


Angular 6 CRUD Operations Application Tutorials

Read :


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

I hope you get an idea about Vue js Axios File Upload using PHP.
I would like to have feedback on my 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.

Related FAQ

Here are some more FAQ related to this Article:

  1.   Laravel 6 Update Increment column
  2.   jQuery Ajax File Upload images using PHP MySQLi
  3.   how to delete (splice) an element from nested JSON using Vuejs
  4.   Vuejs File Type extension Validation
  5.   Laravel Vuejs Ajax Validation Tutorial With Example
  6.   How to Send Push notification using FCM using php
  7.   vue Image Upload Component
  8.   Simple jQuery Fade Effects Example
  9.   Autocomplete Textbox using jQuery, PHP and MySQLi
  10.   PHP Symmetric array destructuring with Associative