Axios is one the most useful Promise based HTTP library used with ReactJS and AngularJs to make a call to the server. Axios is supported by most of the browser. Now in this post, I will explain to you how we can upload image or file to the server with the progress bar. Axios is also very best alternate of Ajax Call and also very fast and lightweight. You can easily add this in your project using CDN or bower. Axios come with no of operations which help you to make a single request or multiple requests in same time. 

Demo Link

Axios come with no of features

  • Make XMLHttpRequests from the browser
  • Make http requests from node.js
  • Supports the Promise API
  • Intercept request and response
  • Transform request and response data
  • Cancel requests
  • Automatic transforms for JSON data
  • Client side support for protecting against XSRF

If you know how Ajax then it is very easy to understand Axios Call, please check below sample code. But before we start we need to add CDN link to load this Plugin in our project.

Installing Axios

Get Request using Axios

Post Request using Axios

Or you can make call in this way

Axios supported all request methods:- GET, POST, PUT, DELETE.

Upload image with progress bar

Most time we need to upload a file to the server and we always want to show the progress bar for doing this there are no of the library but I like Axios it is very easy to use and no need to config other things. Check below code and see how we can upload image and show progress bar

If you want to learn more about Axios you can check this official library

If this post helps you then like our page.