|
|
<?php /* * The MIT License * * Copyright 2019 Blobt. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ ?>
<header> <link href="http://hayageek.github.io/jQuery-Upload-File/4.0.11/uploadfile.css" rel="stylesheet"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="http://hayageek.github.io/jQuery-Upload-File/4.0.11/jquery.uploadfile.min.js"></script> </header> <body> <div id="showoldupload"> <div class="ajax-upload-dragdrop" style="vertical-align: top; width: 600px;"> <div class="ajax-file-upload" style="position: relative; overflow: hidden; cursor: default;">Upload <form method="POST" action="upload.php" enctype="multipart/form-data" style="margin: 0px; padding: 0px;"> <input type="file" id="ajax-upload-id-1573635462220" name="myfile[]" accept="*" multiple="" style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 100%; left: 0px; z-index: 100; opacity: 0;"> </form> </div> <span><b>Drag & Drop Files</b></span></div> <div></div> </div> <div class="ajax-file-upload-container"></div> </body> <script> $("#showoldupload").uploadFile( { url: "upload", dragDrop: true, fileName: "file", returnType: "json", showDelete: true, showDownload: false, statusBarWidth: 300, dragdropWidth: 300, maxFileSize: 200 * 1024, dragDropStr: "<span><b>拖动上传</b></span>", sizeErrorStr: "图片超过最大尺寸限制", uploadErrorStr: "上传失败", showPreview: true, previewHeight: "60px", previewWidth: "60px", onSuccess: function (files, data) { $.ajax({ url: "save-database", dataType: "json", data: {data: data, fileName: files}, }); }, onLoad: function (obj) { $.ajax({ cache: false, url: "previews", dataType: "json", success: function (data) { for (var i = 0; i < data.length; i++) { obj.createProgress(data[i]["name"], data[i]["path"], data[i]["size"]); } } }); }, deleteCallback: function (data, pd) { for (var i = 0; i < data.length; i++) { // alertify.confirm('系统提示', "确定执行批量 '"+act+"' 操作?", function() {
$.post("image-del", {op: "delete", name: data[i]}, function (resp, textStatus, jqXHR) { //Show Message
alert("File Deleted"); }); // },function(){
// });
} pd.statusbar.hide(); //You choice.
},
}); </script>
|