the-cc-dev / filepicker-element

An button for opening the file picker dialog and returning the files picked.

Home Page:http://shama.github.io/filepicker-element/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filepicker-element

An button for opening the file picker dialog and returning the files picked.

example

Usage

var filepicker = require('filepicker-element')

var element = filepicker('Pick a File', function (files) {
  console.log(files[0].name)
})

document.body.appendChild(element)

Set the types of files it accepts:

var element = filepicker({
  accept: '.png,.jpg',
  label: 'Select File'
}, function (files) {
  console.log(files[0].name)
})

Or supply your own custom element as a button:

var bel = require('bel')
var filepicker = require('filepicker-element')

var pick = bel`<a href="#">PICK YER FILE!</a>`
var element = filepicker(pick, function (files) {
  console.log(files)
})

license

(c) 2016 Kyle Robinson Young. MIT License

About

An button for opening the file picker dialog and returning the files picked.

http://shama.github.io/filepicker-element/


Languages

Language:JavaScript 83.9%Language:CSS 9.5%Language:HTML 6.7%