I tried uploading files with the dataTransfer.files but what is the method or property that should be used for reading a single file?
Drag-and-drop editing describes any editing performed by dragging an image, text, or object from one place to another. For example, to move text from one place to another in a document, you could select the text and then click-and-drag that text to another location.
Use the Esc Key and Left Click Locate the file or folder you wish to move by left-clicking on it on your desktop. Hit the “Escape” key on your keyboard once. Release the left-click on your mouse. Drag and drop functionality should now work as normal.
Noun. dropfile (plural dropfiles) (computing, dated) A file used by a bulletin board system (BBS) to pass information about the BBS itself and the current user to an external door.
FileReader.readAsArrayBuffer()
Starts reading the contents of the specified Blob, once finished, the result attribute contains an ArrayBuffer representing the file's data.
FileReader.readAsBinaryString()
Starts reading the contents of the specified Blob, once finished, the result attribute contains the raw binary data from the file as a string.
FileReader.readAsDataURL()
Starts reading the contents of the specified Blob, once finished, the result attribute contains a data: URL representing the file's data.
FileReader.readAsText()
Starts reading the contents of the specified Blob, once finished, the result attribute contains the contents of the file as a text string.
following demo can be helpful for you
Demo
var file = e.dataTransfer.files[0],
reader = new FileReader();
reader.onload = function (event) {
console.log(event.target.result);
//holder.style.background = 'url(' + event.target.result + ') no-repeat center';
};
console.log(file);
reader.readAsDataURL(file);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With