sync-upload
v0.0.4
Published
asynchronous upload file
Downloads
1
Readme
sync-upload
a upload plugin for browser
Usage
<form enctype="multipart/form-data">
<label for="myFile">选择文件</label>
<input type="file" id="myFile" />
</form>
<script>
var Uploader = require('sync-upload')
var uploader = new Uploader({useUi: true})
document.getElementById('myFile').addEventListener('change',e=>{
uploader.init({
url: '//video.qq.com/upload',
data: {
file: e.target
}
})
})
</script>
Uploader(options)
url
cgi for uploaderdata
post data to cgiuseIframe
use iframe method to uploadenctype
request Content-TypecallbackId
iframe frameElement[callbackId]timeout
timeout for requestuseUi
use loading UIextendClass
loading animation classNameprogress
upload progressnot support iframe
success
success to upload eventerror
fail to upload event
External API
getPreviewImageURL
get local file preview Url