caronte-js

2019-08-15

caronte-js是什么

什么是caronte-js,Simple javascript ajax file uploader script made for the modern browsers

caronte-js使用教程帮助文档

Caronte.js - Simple javascript ajax file uploader

Build Status NPM version NPM downloads MIT License

Caronte logo

Portitor has horrendus aquas et flumina servat terribili squalore Charon, cui plurima mento canities inculta iacet, stant lumina flamma, sordidus ex umeris nodo dependet amictus. Aeneid 6.298–301

Installation

Npm

npm install caronte-js --save

bower

bower install caronte-js --save

Usage

Include Caronte.js in you app

<script src="path/to/caronte/dist/Caronte.js"></script>

Create a Caronte.js instance linking it to your form tag

<form
  class="my-form"
  enctype="multipart/form-data"
  action="php/index.php"
  method="post">
  <input name="files[]" type="file" multiple>
  <button type="submit">Send</button>
</form>
var uploader = new Caronte('.my-form')
uploader.on('progress', function(percentage) {
  // show the progress of your upload
})
uploader.on('success', function(res) {
  // do something with response coming from the server
})
uploader.on('error', function(res) {
  // oups there was an error
})
uploader.on('abort', function(res) {
  // the upload was aborted
})

API

  • on([string, function]): listen any event triggered from the script
  • one([string, function]): listen any event only once
  • off([string, function]): stop listening any Caronte.js event
  • destroy: destroy a Caronte.js instance killing all its events listeners

Credits

Logo by bubachop


上一篇:yia
下一篇:primus-responder
相关文章

首次访问,人机识别验证

扫描下方二维码回复 1024 获取验证码,验证完毕后 永久 无须验证

操作步骤:[打开微信]->[扫描上侧二维码]->[关注 FedJavaScript 的微信] 输入 1024 获取验证码

验证码有误,请重新输入