Small JavaScript library to allow dropping files in textarea.
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>
No dependency.
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.
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) |
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 |
This project is under MIT License.