You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
3.1 KiB
PHTML
76 lines
3.1 KiB
PHTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Upload Module</title>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<div id="upload"></div>
|
|
</div>
|
|
|
|
<script src="{{ASSET}}/datatable/file.js"></script>
|
|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
|
<script>
|
|
|
|
const _uploadFiles = (function(){
|
|
return {
|
|
rule : {
|
|
id: null,
|
|
element: null,
|
|
},
|
|
change: function(n){
|
|
console.log(n);
|
|
n.addEventListener('change', function(){
|
|
var f = Array.from(n.files);
|
|
console.log(f);
|
|
}, false);
|
|
return this;
|
|
},
|
|
render: function(id){
|
|
this.rule.id = 'rule-upload'+Date.now();
|
|
var idRule = this.rule.id;
|
|
var g = document.getElementById(id);
|
|
g.innerHTML = `
|
|
<style>
|
|
input[type="file"] {
|
|
display: none;
|
|
}
|
|
label[for="${idRule}"] {
|
|
display: block;
|
|
position: relative;
|
|
background-color: #025bee;
|
|
color: #ffffff;
|
|
font-size: 1.1em;
|
|
text-align: center;
|
|
width: 16em;
|
|
padding: 1em 0;
|
|
border-radius: 0.3em;
|
|
margin: 0 auto 1em auto;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
|
|
<input type="file" id="${idRule}" multiple accept="image/*" />
|
|
<label for="${idRule}">
|
|
<i class="fa-solid fa-upload"></i> Choose Or Drop Photos
|
|
</label>
|
|
`;
|
|
this.rule.element = document.getElementById(id).querySelector("input");
|
|
this.change(this.rule.element);
|
|
|
|
return this;
|
|
}
|
|
}
|
|
})();
|
|
|
|
_uploadFiles.render('upload');
|
|
|
|
</script>
|
|
</body>
|
|
</html> |