{"id":23053378,"url":"https://github.com/component/file-picker","last_synced_at":"2025-04-03T04:24:27.408Z","repository":{"id":8462363,"uuid":"10059561","full_name":"component/file-picker","owner":"component","description":"File picker component","archived":false,"fork":false,"pushed_at":"2016-04-11T06:40:26.000Z","size":54,"stargazers_count":23,"open_issues_count":4,"forks_count":6,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-09T02:46:38.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://component.github.io/file-picker","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/component.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-14T16:28:38.000Z","updated_at":"2025-01-20T05:20:48.000Z","dependencies_parsed_at":"2022-07-30T00:47:53.571Z","dependency_job_id":null,"html_url":"https://github.com/component/file-picker","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Ffile-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Ffile-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Ffile-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Ffile-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/component","download_url":"https://codeload.github.com/component/file-picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246935225,"owners_count":20857364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-16T00:17:52.860Z","updated_at":"2025-04-03T04:24:27.363Z","avatar_url":"https://github.com/component.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Picker\n\n  Opens a file picker dialog upon being called. Doesn't need a DOM\n  element or pre-existing `\u003cinput type=\"file\"\u003e`.\n\n  __Note:__ This component inserts the element when required, so the body element needs to be loaded beforehand.\n  \n  __Note:__ For security reasons, `file-picker` must be triggered by an original DOM event (`click`, `touchstart`, `keyup`, etc.). It cannot be called `onload` or in a timeout.\n\n## Installation\n\n    $ component install component/file-picker\n\n## Usage\n\n```js\nvar filePicker = require('file-picker');\n\n// Upload a single file\n$('single-link').click(function() {\n  filePicker(function(files){});\n});\n\n// Upload multiple files (on supported web browsers)\n$('multiple-link').click(function() {\n  filePicker({ multiple: true }, function(files){});\n});\n\n// Upload a directory (on supported web browsers)\n$('directory-link').click(function() {\n  filePicker({ directory: true }, function(files){});\n});\n\n// Accept only image files or .psd files\n$('image-link').click(function() {\n  filePicker({ accept: [ 'image/*', '.psd' ] }, function(files){});\n});\n```\n\n## API\n\n### filePicker(opts, fn)\n\n  Valid options:\n\n  - `multiple` (Boolean) whether the user can select multiple files\n    if the UA supports it (defaults to `false`).\n  - `directory` (Boolean) whether the user can select a directory\n    if the UA supports it (defaults to `false`).\n  - `accept` (String) tell the browser to only allow selecting files\n    of this type. If several types, you may pass in an array of types. [Some examples](http://stackoverflow.com/questions/181214/file-input-accept-attribute-is-it-useful/10503561#10503561).\n\n  The callback `fn` will only be invoked if the underlying `\u003cinput\u003e`\n  fires a `change` event. It will receive the following parameters:\n\n  - The `files` array from the `\u003cinput\u003e` (not available on IE9).\n  - The change `event` object.\n  - The underlying `\u003cinput\u003e` element reference (detached from DOM).\n\n## Browser support\n\n - Internet Explorer 9+\n - Firefox\n - Chrome\n - Opera\n - Safari\n - Mobile Safari\n - Android Browser\n\n## License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomponent%2Ffile-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomponent%2Ffile-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomponent%2Ffile-picker/lists"}