Skip to content
/ LZFile Public

Images File Upload widget with multiple file selection, drag&drop support, progress bar, validation filter and preview images for zepto, usually used in webapp with ios and android. that only supports standard HTML5. https://l-zhi.github.io/LZFile/

License

Notifications You must be signed in to change notification settings

l-zhi/LZFile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LZFile

Images File Upload widget with multiple file selection, drag&drop support, progress bar, exif, validation filter and preview images for zepto, usually used in webapp with ios and android. that only supports standard HTML5.

图片上传组件基于zepto,通过exif-js获取图片描述信息,只支持HTML5, 适用于 IOS 和 android webapp 开发,或是支持html5 的 chrome,safari。支持图片上传预览,以及拖拽,进度条等超轻量级组件

First you must include Zepto and LZFile in your code:

<script src="dist/js/zepto.js"></script>
<script src="dist/js/lzfile.zepto.min.js"></script>

HTML code:

<div class="J_upload mod-upload-pic"></div>

javascript code:

var lzfile = $(".J_upload").LZFile({
        "url":"", // action url
        "onSuccess":function(data){
            //TODO
        }
    });
lzfile.upload(); // 上传图片方法

image information

{"name":"test.jpeg","size":190265,"type":"image/jpeg","PixelXDimension":750,"PixelYDimension":1334,"Software":"Instagram"}

Example

Demo

API:

options

LZFile.fn._defaultOptions = {
    dragDrop: true,
    url: '', //action url
    onSelected: function(){}, //选择文件后调用
    onDragOver: function(){}, //拖动时调用
    onDragLeave: function(){}, //拖动离开时调用
    onProgress: function(){}, //进度
    onSuccess: function(){}, //成功
    onFailure: function(){}, //失败
    onComplete: function(){}, //完成
    filter:  function(){} // 过滤文件方法
};

settings

dragDrop

boolean Whether to close drag event or open it

url

action url

onSelected

Fires while files is selected

onDragOver

Fires while a file drag over the dom

onDragLeave

Fires while a file drag leave the dom

onProgress

Fires while a file is being uploaded. Use this event to update the current file upload progress

onSuccess

Fires when a file is successfully uploaded

onFailure

Fires when a file is failure uploaded

onComplete

Fires when all files are uploaded or no files uploaded

filter

filter files and required return files

###function ####delFile(index) index: the index of the file in array

####upload Uploader instance sending the event

####currentFiles Current Files

License

All code licensed under the MIT License.

About

Images File Upload widget with multiple file selection, drag&drop support, progress bar, validation filter and preview images for zepto, usually used in webapp with ios and android. that only supports standard HTML5. https://l-zhi.github.io/LZFile/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published