Hey friends, today in this blog you'll learn how to create a Drag & Drop or Browse - File upload Feature using HTML CSS & JavaScript. In the earlier blog, I have also shared how to upload an image by clicking on the browse button but now in this blog, I'll teach you how you can upload an image file by drag & drop or by clicking on the browse file button.
Drag and Drop file upload means you can upload the file by drag & drop. Drag and Drop interfaces permit web applications to drag and drop files on a web page. You may have seen this type of file upload feature on most sites. There are many JavaScript libraries to create this type of drag & drop file upload feature with a few lines of JavaScript codes but today in this blog I'll create it with pure JavaScript means without using any library.
In this program [Drag & Drop or Browse - File upload Feature], on the webpage, there is a drop area container with some text, icon, and browse file button. When you drag any image file over the drag area, the border of the container also changed to solid, and the text "Drag & Drop to upload file" also changed to "Release to upload file". When you release your image file in the drag area, immediately the preview of that image will appear. You can also upload an image by clicking on the browse file button. When you click on the button, there is open a file window and you have to select one image file, after you selected it then it will appear in the drag area.
If you're feeling difficult to understand what I'm saying then you can watch the demo video of this program or watch the full video tutorial and learn how it is actually created.

Hello Sir Plz Make A Video Or Write A Post Related Of Video Media Season Full Tutorial With Source Code
ReplyDeleteOk I'll think on it
Deletehow to add more extensions like pdf document files etc
ReplyDeletelet validExtensions = ["image/jpeg", "image/jpg", "image/png", "type/extension_here"]; add more types here
DeleteAfter the page refreshes, how do you get the picture to stay?
ReplyDeletePost a Comment
We welcome relevant and respectful comments. Off-topic or spam comments may be removed.