https://github.com/fizzygalacticus/uploadarea
A functional yet customizeable drag and drop file uploader written in Vanilla Javascript.
https://github.com/fizzygalacticus/uploadarea
Last synced: about 2 months ago
JSON representation
A functional yet customizeable drag and drop file uploader written in Vanilla Javascript.
- Host: GitHub
- URL: https://github.com/fizzygalacticus/uploadarea
- Owner: FizzyGalacticus
- License: mit
- Created: 2017-03-08T07:07:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-08T09:49:11.000Z (over 8 years ago)
- Last Synced: 2024-04-24T14:10:37.349Z (about 2 years ago)
- Language: JavaScript
- Size: 50.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UploadArea
This project is to (hopefully) become an extremely easy to use, fully customizable drag-and-drop file upload handler written in ES6 and compiled down to ES5.
All you need to do to get started is create a ```
``` with an id, then create a new ```UploadArea``` object with the id and page to POST to specified in the options:
```html
Drag Here
var uploadArea = new UploadArea('myDragDrop', {sendTo:'https://myurl.com'});
```
Here is a full list of options/functions that can be passed to the constuctor:
**Name**|**Type**|**Description**
-----|-----|-----
sendTo|string|URL to post files to. By default this is ```https://posttestserver.com/post.php```.
allowDrop|boolean|Default value is ```true```. When true, allows users to drag and drop files into the UploadArea for uploading.
upload|function|When set, this is called instead of the UploadArea default upload function. It is passed a list of File objects which can be used for custom uploading.
progress|function|Function to be called when upload progress is made. When overridden without the upload function being overridden, this is passed an XMLHttpRequest progress event.
complete|function|Called when upload has completed successfully and is passed the response message from the server.
error|function|Called when an error occurs during the upload process and is passed the full response from the server.
allowMultiple|boolean|Default value is ```true```. When true, UploadArea will allow multiple file uploads at the same time. When false, only a single file is allowed. When multiple files are dropped onto the UploadArea and this is false, only the first file in the array is sent.