It's my Simple File Handle, the lightest and simplest file handler ever.
-
Attention: It doesn't have any visual interface. Instead of, it gives you the treated callback with the informations about the files as its name, size and the original file object at every change input event.
- Less than 1 KByte!
- Fast!
- Allow multiple files!
- Simple!
-
- Import JQuery..
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
-
- ... and this plugin:
<script src="https://cdn.jsdelivr.net/gh/Romuloalmeida/[email protected]/dist/simple-file-handler-min.js"></script>
-
- Use it:
$(".file_input").filesHandler(function(files){
// That's it! At every change input it will execute!
} )
-array
- object
- name => Name of your file
- size => Size of your file in bytes
- file => The file object itself!
$(".file_input").filesHandler(function(files){
var input = $(this);
if (files.length > 0)
{
files.forEach( (f)=>{
var size = bytesToSize(f.size);
var name_file = f.name;
item.insertBefore(".list")
});
}
});
Author: Rômulo Almeida.