帝国模板之家为广大用户提供专业、一站式建站服务。

网页特效

网页特效栏目收集了最全最新的前端网页插件,包括最流行的jQuery,Bootstrap,Js,Css,Vue等主流特效插件。

当前位置:首页 > 资源 > 网页特效 > 正文

jQuery+php文件响应分块上传插件(支持拖拽,文件预览)

帝国模板之家 2020-11-30 网页特效 评论

插件介绍

这是一款jQuery文件上传插件,支持拖拽、键盘交互、文件预览、文件分块上传等。服务端php处理文件在压缩包内。

使用方法

1. 在html页面加载主CSS文件。

<link rel="stylesheet" href="fancy_fileupload.css">

2. 在html页面末尾加载插件必要的js文件。

<script src="jquery.min.js"></script>
<script src="jquery.ui.widget.js"></script>
<script src="jquery.fileupload.js"></script>
<script src="jquery.iframe-transport.js"></script>
<script src="jquery.fancy-fileupload.js"></script>

3. 插件初始化,指定服务器接受的文件类型:

<input id="demo" type="file" name="files" accept=".jpg, .png, image/jpeg, image/png" multiple>
$('#demo').FancyFileUpload({
  params : {
    action : 'fileuploader'
  },
  maxfilesize : 1000000
});

4.插件支持的配置项。

$('#demo').FancyFileUpload({

  // send data to this url
  'url' : '',

  // key-value pairs to send to the server
  'params' : {},

  // editable file name?
  'edit' : true,

  // max file size
  'maxfilesize' : -1,

  // a list of allowed file extensions
  'accept' : null,

  // 'iec_windows', 'iec_formal', or 'si' to specify what units to use when displaying file sizes
  'displayunits' : 'iec_windows',

  // adjust the final precision when displaying file sizes
  'adjustprecision' : true,

  // the number of retries to perform before giving up
  'retries' : 5,

  // the base delay, in milliseconds, to apply between retries
  'retrydelay' : 500,

  // an object containing valid MediaRecorder options
  // https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder
  'audiosettings' : {},

  // whether or not to display a toolbar button with a webcam icon for recording video directly via the web browser 
  'recordvideo' : false,

  // an object containing valid MediaRecorder options
  // https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder
  'videosettings' : {},

  // A valid callback function that is called after the preview dialog appears. Useful for temporarily preventing unwanted UI interactions elsewhere.
  'showpreview' : function(e, data, preview, previewclone) {
    // do something
  },

  // A valid callback function that is called after the preview dialog disappears. 
  'hidepreview' : function(e, data, preview, previewclone) {
    // do something
  },

  // A valid callback function that is called during initialization to allow for last second changes to the settings. 
  // Useful for altering fileupload options on the fly. 
  'preinit' : null,

  // A valid callback function that is called at the end of initialization of each instance. 
  'postinit' : null,

  // called for each item after it has been added to the DOM
  'added' : function(e, data) {
    // do something
  },

  // called whenever starting the upload
  'startupload' : function(SubmitUpload, e, data){
    // do something
  }

  // called whenever progress is updated
  'continueupload' : function(e, data) {
    // do something
  },

  // called whenever an upload has been cancelled
  'uploadcancelled' : function(e, data) {
    // do something
  },

  // called whenever an upload has successfully completed
  'uploadcompleted' : function(e, data) {
    // do something
  },

  // jQuery File Upload options
  'fileupload' : {},

  // translation strings here
  'langmap' : {}

});
这世上无忧无虑的人,反而相对寿命会长点。

已有 位小伙伴发表了看法

欢迎 发表评论

  • 匿名发表

关于

帝国cms模板

网页插件

帝国模板之家 | www.moyouyouw.cn

本站所有模板/文章除标明原创外,均来自网络转载,版权归原作者所有,如果有侵犯到您的权益,请联系站长删除,谢谢! 寻找帝国cms模板首选帝国模板之家,用心做站,上线至今广受好评,值得信赖!

  • 交流群1:帝国cms交流群1
  • 交流群2:帝国cms交流群2
在线QQ 给我留言