sync-upload

0.0.4 • Public • Published

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 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 progress not support iframe
  • success success to upload event
  • error fail to upload event

External API

  • getPreviewImageURL get local file preview Url

Readme

Keywords

Package Sidebar

Install

npm i sync-upload

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

35 kB

Total Files

9

Last publish

Collaborators

  • zobor