Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juicy/juicy-filedrop

FileDrop panel
https://github.com/juicy/juicy-filedrop

polymer

Last synced: 11 days ago
JSON representation

FileDrop panel

Awesome Lists containing this project

README

        

# <juicy-filedrop>

> Polymer Element with file drop panel

## Demo

[Check it live!](http://Juicy.github.io/juicy-filedrop)

## Install

Install the component using [Bower](http://bower.io/):

```sh
$ bower install juicy-filedrop --save
```

Or [download as ZIP](https://github.com/Juicy/juicy-filedrop/archive/master.zip).

## Usage

1. Import Web Components' polyfill (if needed):

```html

```

2. Import Custom Element:

```html

```

3. Start using it!

```html

```

## Options

Attribute | Options | Default | Description
--- | --- | --- | ---
`url` | *string* | `` | URL to files storage server.
`customheader` | *string* | `x-file` | Name for custom header that contains JSON with file meta data.
`maxfilesize` | *int* | `524288` | Maximum file size in bytes, 512 KiB by default.
`allowedmimetypes` | *string* | `image/gif,image/jpeg,image/png,image/svg+xml` | Allowed mime types.

## Events

Event | `event.detail` | Description
--- | --- | ---
`fileUploading` | `{ type: "mime/type", name: "file_name.ext" }` | Triggers when uploading starts.
`fileUploaded` | `{ type: "mime/type", name: "file_name.ext", status: 200, statusText: "OK", url: "location" }` | Triggers when files was successfully uploaded.
`fileUploadError` | `{ type: "mime/type", name: "file_name.ext", status: 500, statusText: "Internal Error", url: "" }` | Triggers when upload fails.
`fileSelectError` | `{ file: { type: "mime/type", name: "file_name.ext" }, message: "file_name.ext has invalid mime type." }` | Triggers when selected file is too big or has not allowed mime type.

## Methods

Event | Description
--- | ---
`openFile` | Opens file prompt

## [Contributing and Development](CONTRIBUTING.md)

## History

For detailed changelog, check [Releases](https://github.com/Juicy/juicy-filedrop/releases).

## License

MIT