Skip to content

JavaScript library to upload files via drop to textarea

License

Notifications You must be signed in to change notification settings

antalaron/drop-upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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.

About

JavaScript library to upload files via drop to textarea

Topics

Resources

License

Stars

Watchers

Forks