Laravel Image upload without submit button or form tag| Preview, Save, validate Image

This post will tell you How to upload Image without button or form tag in Laravel. Usually, we upload the image by form submit button but sometimes we have to use or upload an image without the submit button or form tag in case of requirements. Here we have discussed one of the topics based on ajax which is how to upload files or images without using Form Submit with Ajax request without page refresh. In addition, we will cover image preview, validation depends on image types, store or saves in database. So let’s dig in.

 

Upload Image without Submit Button or Form tag in Laravel

Upload Image without Submit Button or Form tag in Laravel

Laravel Image upload without button

In web.php

In mainproject/app/Http/Controllers/EmpController.php

In mainproject/resources/views/welcome.blade.php

Note:

  • This
  • new FileReader() =Here new FileReade() is creating new file reader object. FileReader is used to read the contents of a Blob or File
  • .onload
  • readAsDataURL
  • .empty()

 

 

 

youtube link https://www.youtube.com/watch?v=aIWgqJtYwrY

Share with:


Comments are closed.