# drop-upload

> JavaScript library to upload files via drop to textarea

Latest version **0.2.1** (published 2018-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install drop-upload
pnpm add drop-upload
yarn add drop-upload
bun add drop-upload
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2018-07-25 |
| First published | 2018-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Antal Áron |
| Maintainers | antalaron |
| Keywords | drop, upload, textarea |

## Links

- npm: https://www.npmjs.com/package/drop-upload
- Repository: https://github.com/antalaron/drop-upload
- Homepage: https://github.com/antalaron/drop-upload#readme
- Issues: https://github.com/antalaron/drop-upload/issues
- npm.io page: https://npm.io/package/drop-upload

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 0.2.1 (latest) — 2018-07-25
- 0.2.0 — 2018-05-16
- 0.1.3 — 2018-03-09
- 0.1.2 — 2018-03-07
- 0.1.1 — 2018-03-04
- 0.1.0 — 2018-03-04

## README

Drop Upload
===========

Small JavaScript library to allow dropping files in textarea.

Installation
------------

Via npm:
```bash
$ npm install --save drop-upload
```

Via bower:
```bash
$ bower install jquery-miller-columns
```

Manual installation:

Download the [latest release](https://github.com/antalaron/drop-upload/releases).

Via CDN:

```html
<script src="//cdn.jsdelivr.net/npm/drop-upload/dist/drop-upload.min.js"></script>
```

Dependecies
-----------

No dependency.

Usage
-----

Call on the desired element:

```javascript
// DropUpload([parentSelector], [childSelector], [options]); eg:
DropUpload(document, 'textarea.uploadable-textarea');
```

First argument is the propagated target, second is the target selector (like in jQuery
`$(document).on('event', '.uploadable-textarea', function() {...})`), third is the options.

API reference
-------------

### Options

| Key                    | Default value                   | Description                             |
|:---------------------- |:------------------------------- |:--------------------------------------- |
| uploadPath             | /upload                         | Path to upload                          |
| uploadKey              | file                            | Key of the file in upload content       |
| uploadingCallback      | function (fileName) {...}       | The value in the textarea during upload |
| uploadedCallback       | function (fileName, path) {...} | The value in the textarea after upload  |
| decodeResponseCallback | function (response) {...}       | Decoding response                       |
| timeout                | 0                               | Timeout for requests (in ms)            |

### Events

| Event name          | Description                |
|:------------------- |:-------------------------- |
| drop-upload:start   | Upload started             |
| drop-upload:end     | Upload ended               |
| drop-upload:success | Upload ended with success  |
| drop-upload:error   | Upload failed              |
| drop-upload:timeout | Upload failed with timeout |


License
-------

This project is under [MIT License](http://opensource.org/licenses/mit-license.php).

---
_Source: https://npm.io/package/drop-upload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
