0.2.1 • Published 6 years ago

drop-upload v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Drop Upload

Small JavaScript library to allow dropping files in textarea.

Installation

Via npm:

$ npm install --save drop-upload

Via bower:

$ bower install jquery-miller-columns

Manual installation:

Download the latest release.

Via CDN:

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

Dependecies

No dependency.

Usage

Call on the desired element:

// 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

KeyDefault valueDescription
uploadPath/uploadPath to upload
uploadKeyfileKey of the file in upload content
uploadingCallbackfunction (fileName) {...}The value in the textarea during upload
uploadedCallbackfunction (fileName, path) {...}The value in the textarea after upload
decodeResponseCallbackfunction (response) {...}Decoding response
timeout0Timeout for requests (in ms)

Events

Event nameDescription
drop-upload:startUpload started
drop-upload:endUpload ended
drop-upload:successUpload ended with success
drop-upload:errorUpload failed
drop-upload:timeoutUpload failed with timeout

License

This project is under MIT License.

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago