However this hasn't been without numerous sound reasons!
Imagine a webpage creating tons of files on your computer, or editing existing files there - it would be one of the worst forms of software vulnerabilities; allowed by the browser's vendor itself!
It's simply not safe to allow any remote webpage to create, modify, delete, or even read a random file on the client's computer. The data can be sensitive and thus allowing access to it would mean passing on sensitive information to an undesirable source! Something really crazy!
With the advent of HTML forms, it meant that users could manually select given files on their computers to be read by the browser and then consequently sent over to a server (which is the purpose of a form).
First of all we have the
File interface. It's used to represent objects containing useful information about given files.
files property on an
input element of type
"file"; and on the
dataTransfer property of a
ondrop handler's event argument, in both cases, holds a list of
This interface inherits from a recently common interface known as
Blob, abbreviation for Binary Large Object
Blob objects are used to represent raw file data in binary format, and likewise can be passed to the
Last but not the least, comes the extremely powerful
FileReader API, which enables asynchronous file reading operations.
The interface has recently become quite popular due to the fact that it can be used to power some extemely stunning features such as displaying user-selected image files on the go - a feature many applications utilise to give a 'profile picture preview'.