a upload plugin for browser
<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>
-
url
cgi for uploader -
data
post data to cgi -
useIframe
use iframe method to upload -
enctype
request Content-Type -
callbackId
iframe frameElement[callbackId] -
timeout
timeout for request -
useUi
use loading UI -
extendClass
loading animation className -
progress
upload progressnot support iframe
-
success
success to upload event -
error
fail to upload event
-
getPreviewImageURL
get local file preview Url