Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/dropload
Drag and drop uploads
https://github.com/component/dropload
Last synced: 12 days ago
JSON representation
Drag and drop uploads
- Host: GitHub
- URL: https://github.com/component/dropload
- Owner: component
- Created: 2012-09-12T21:21:41.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-16T22:22:31.000Z (almost 10 years ago)
- Last Synced: 2024-04-14T02:18:53.951Z (9 months ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 26
- Watchers: 6
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# Dropload
Drag and drop upload component.
## Installation
$ component install component/dropload
## Events
- `upload` (upload) a file was dropped
- `text` (string) string representation
- `url` (string) url representation
- `html` (string) html representation
- `drop` (event) a drop was performed## Example
```js
var Dropload = require('dropload');
var drop = Dropload(document.getElementById('drop'));drop.on('error', function(err){
console.error(err.message);
});drop.on('upload', function(upload){
console.log('uploading %s', upload.file.name);
upload.to('/upload');
});drop.on('text', function(str){
console.log('text "%s"', str);
});drop.on('url', function(str){
console.log('url "%s"', str);
});drop.on('html', function(str){
console.log('html "%s"', str);
});
```## Running example
Run the Express test server:
```
$ npm install
$ make test
```# License
MIT