Template in Vue Uploader component
11 Jun 202424 minutes to read
You can customize the default appearance of the uploader using a template along with buttons.
File list template
The template property is used to customize the default appearance of each file in the list. It can be represented as the HTML element or string. The selected or dropped files are displayed as per the template layout provided. The remove and progress bar action is handled using the corresponding events when the template is defined.
For example, you can display file type icon along with default UI elements.
<template>
<div>
<div class="col-lg-12 control-section uploader customdroparea">
<div class="control_wrapper">
<div class="sample_wrapper">
<div id="dropArea">
<span id="drop" class="droparea"> Drop files here or <a href="" id="browse"><u>Browse</u></a>
</span>
<ejs-uploader id='templateupload' name="UploadFiles" :template='fileTemplate'
:allowedExtensions='extensions' :asyncSettings="path" ref="uploadObj" :dropArea="dropArea"
:success="onSuccess" :failure="onFailure" :progress="onProgress" :removing="onFileRemove">
</ejs-uploader>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { UploaderComponent as EjsUploader } from '@syncfusion/ej2-vue-inputs';
import { detach } from '@syncfusion/ej2-base';
import { createApp, onMounted, ref } from 'vue';
const uploadObj = ref(null);
const app = createApp();
var demoVue = app.component("demoTemplate", {
template: `<div class='container'>
<span class='wrapper'>
<span :class="['icon sf-icon-' +data.type]"></span>
<span class='name file-name'> ( bytes)</span>
<span class='upload-status'></span>
<span class='e-icons e-file-remove-btn' title='Remove'></span>
</span>
</div>`,
data() {
return {
data: {}
};
}
});
const path = {
saveUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Save',
removeUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Remove'
};
const extensions = '.pdf, .png, .txt';
const dropArea = "#dropArea";
const fileTemplate = () => {
return { template: demoVue }
}
onMounted(() => {
document.getElementById('browse').onclick = function () {
document.getElementsByClassName('e-file-select-wrap')[0].querySelector('button').click();
return false;
};
document.getElementById('dropArea').onclick = (args) => {
if (args.target.classList.contains('e-file-delete-btn')) {
for (var i = 0; i < uploadObj.value.getFilesData().length; i++) {
if (args.target.closest('li').getAttribute('data-file-name') === uploadObj.value.getFilesData()[i].name) {
uploadObj.value.remove(uploadObj.value.getFilesData()[i]);
}
}
}
else if (args.target.classList.contains('e-file-remove-btn')) {
detach(args.target.closest('li'));
}
};
});
const onSuccess = (args) => {
let li = getLiElement(args);
li.querySelector('.upload-status').innerHTML = args.file.status;
li.querySelector('.upload-status').classList.add('upload-success');
};
const onFailure = (args) => {
let li = getLiElement(args);
li.querySelector('.upload-status').innerHTML = args.file.status;
li.querySelector('.upload-status').classList.add('upload-failed');
};
const getLiElement = (args) => {
let liElements = document.getElementsByClassName('e-upload')[0].querySelectorAll('.e-upload-files > li');
let li;
for (let i = 0; i < liElements.length; i++) {
if (liElements[i].getAttribute('data-file-name') === args.file.name) {
li = liElements[i];
}
}
return li;
};
const onProgress = (args) => {
let progressValue = Math.round((args.e.loaded / args.e.total) * 100) + '%';
let li = getLiElement(args);
li.querySelector('.upload-status').innerHTML = args.file.status + '(' + progressValue + ' )';
};
const onFileRemove = (args) => {
args.postRawFile = false;
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
#container {
visibility: hidden;
padding-left: 5%;
width: 100%;
}
#loader {
color: #008cff;
font-family: 'Helvetica Neue', 'calibiri';
font-size: 14px;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.sf-icon-bmp:before {
content: "\e700";
}
.sf-icon-xlsx:before,
.sf-icon-XLSX:before {
content: "\e701";
}
.sf-icon-avi:before,
.sf-icon-AVI:before {
content: "\e702";
}
.sf-icon-doc:before,
.sf-icon-DOC:before {
content: "\e703";
}
.sf-icon-exe:before {
content: "\e704";
}
.sf-icon-mp4:before {
content: "\e705";
}
.sf-icon-zip:before,
.sf-icon-ZIP:before {
content: "\e706";
}
.sf-icon-tar:before {
content: "\e707";
}
.sf-icon-docx:before {
content: "\e708";
}
.sf-icon-jpg:before {
content: "\e709";
}
.sf-icon-png:before {
content: "\e70a";
}
.sf-icon-gif:before {
content: "\e70b";
}
.sf-icon-pdf:before {
content: "\e70c";
}
.sf-icon-txt:before {
content: "\e70d";
}
.sf-icon-jpeg:before {
content: "\e70e";
}
.sf-icon-xls:before {
content: "\e70f";
}
.sf-icon-mp3:before {
content: "\e710";
}
.customdroparea .e-upload {
border-top: none;
border-bottom: none;
}
.customdroparea .e-upload .e-upload-files {
border-top: none;
}
.customdroparea {
margin: auto 160px;
}
.customdroparea #dropArea .e-upload .e-upload-files .e-upload-file-list {
min-height: 0;
}
.customdroparea #drop {
padding: 6% 27% 6% 22%;
display: block;
border: 1px dashed #c3c3cc;
}
.customdroparea #drop a {
color: blue;
}
.highcontrast .customdroparea #drop a {
color: #ffd939;
}
.customdroparea #UploaderDropTarget {
min-height: 50px;
padding-top: 15px;
position: relative;
display: inline-block;
font-size: 13px;
top: -29px;
width: 400px;
}
.customdroparea .e-file-select-wrap {
display: none;
}
.customdroparea span.dropText {
position: relative;
left: 31%;
top: 101px;
}
.customdroparea .dropArea_wrap {
width: 400px;
height: 250px;
background-color: lightgrey;
display: inline-block;
margin: 22px;
border: 1px dashed grey;
}
.highcontrast .customdroparea .dropArea_wrap {
background-color: #000;
}
.customdroparea .font-icons {
position: relative;
top: 25%;
left: 32%;
width: 150px;
}
.customdroparea .upload-failed {
color: #d9534f;
}
.customdroparea .e-upload .wrapper .upload-success {
color: #107c10;
}
.customdroparea span.upload-status {
left: 45px;
position: relative;
font-size: 12px;
display: block;
padding: 5px;
top: -8px;
}
#UploaderDropTarget .e-upload .e-upload-files .e-file-reload-btn:hover,
#dropArea .e-upload .e-upload-files .e-file-reload-btn {
display: none;
}
#UploaderDropTarget .e-file-abort-btn.e-upload-progress {
background-image: none;
cursor: default;
opacity: .35;
}
#UploaderDropTarget .e-icons.e-file-delete-btn:hover {
background: none;
}
.customdroparea .e-upload .e-upload-files .e-file-remove-btn.e-icons,
.customdroparea .e-upload .e-upload-files .e-file-delete-btn.e-icons {
top: 50%;
}
@font-face {
font-family: 'FiletypeV2 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ABGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIAB1AHMAaQBuAGcAIABTAHkAbgBjAGYAdQBzAGkAbwBuACAATQBlAHQAcgBvACAAUwB0AHUAZABpAG8AdwB3AHcALgBzAHkAbgBjAGYAdQBzAGkAbwBuAC4AYwBvAG0AAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAQIBAwEEAQUBBgEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETAANCTVAEWExTWANBVkkDRE9DA0VYRQNNUDQDWklQA1RBUgRET0NYA0pQRwNQTkcDR0lGA1BERgNUWFQESlBFRwNYTFMDTVAzAAA=) format('truetype');
font-weight: normal;
font-style: normal;
}
[class^="sf-icon-"],
[class*=" sf-icon-"] {
font-family: 'FiletypeV2 Font' !important;
speak: none;
font-size: 35px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
top: 15px;
}
.customdroparea .ul-element {
list-style: none;
width: 100%;
padding-left: 0;
}
.customdroparea span.list-wrapper {
max-height: 400px;
display: block;
margin-left: 10px;
position: relative;
top: 2px;
}
.customdroparea .file-name {
padding: 8px 6px 5px 12px;
font-size: 13px;
width: 76%;
display: inline-block;
position: relative;
}
.customdroparea .file-size {
padding: 4px;
font-size: 13px;
width: 18%;
display: inline-block;
position: relative;
}
.customdroparea .file-lists {
border: 1px solid lightgray;
padding: 0 6px 0 14px;
margin-top: 15px;
position: relative;
background: rgba(0, 0, 0, 0.04);
}
.customdroparea .file-size,
.customdroparea .file-name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
/* csslint ignore:end */
</style>
<template>
<div>
<div class="col-lg-12 control-section uploader customdroparea">
<div class="control_wrapper">
<div class="sample_wrapper">
<div id="dropArea">
<span id="drop" class="droparea"> Drop files here or <a href="" id="browse"><u>Browse</u></a>
</span>
<ejs-uploader id='templateupload' name="UploadFiles" :template='fileTemplate'
:allowedExtensions='extensions' :asyncSettings="path" ref="uploadObj" :dropArea="dropArea"
:success="onSuccess" :failure="onFailure" :progress="onProgress" :removing="onFileRemove">
</ejs-uploader>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { UploaderComponent } from '@syncfusion/ej2-vue-inputs';
import { detach } from '@syncfusion/ej2-base';
import {createApp} from 'vue';
var demoVue = createApp().component("demo", {
template: `<div class='container'>
<span class='wrapper'>
<span :class="['icon sf-icon-' +data.type]"></span>
<span class='name file-name'> ( bytes)</span>
<span class='upload-status'></span>
<span class='e-icons e-file-remove-btn' title='Remove'></span>
</span>
</div>`,
data() {
return {
data: {}
};
}
});
export default {
name: "App",
components: {
"ejs-uploader": UploaderComponent
},
data: function () {
return {
path: {
saveUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Save',
removeUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Remove'
},
extensions: '.pdf, .png, .txt',
dropArea: "#dropArea",
fileTemplate: function () {
return { template: demoVue }
}
}
},
mounted: function () {
document.getElementById('browse').onclick = function () {
document.getElementsByClassName('e-file-select-wrap')[0].querySelector('button').click();
return false;
};
document.getElementById('dropArea').onclick = (args) => {
if (args.target.classList.contains('e-file-delete-btn')) {
for (var i = 0; i < this.$refs.uploadObj.getFilesData().length; i++) {
if (args.target.closest('li').getAttribute('data-file-name') === this.$refs.uploadObj.getFilesData()[i].name) {
this.$refs.uploadObj.remove(this.$refs.uploadObj.getFilesData()[i]);
}
}
}
else if (args.target.classList.contains('e-file-remove-btn')) {
detach(args.target.closest('li'));
}
};
},
methods: {
onSuccess: function (args) {
let li = this.getLiElement(args);
li.querySelector('.upload-status').innerHTML = args.file.status;
li.querySelector('.upload-status').classList.add('upload-success');
},
onFailure: function (args) {
let li = this.getLiElement(args);
li.querySelector('.upload-status').innerHTML = args.file.status;
li.querySelector('.upload-status').classList.add('upload-failed');
},
getLiElement: function (args) {
let liElements = document.getElementsByClassName('e-upload')[0].querySelectorAll('.e-upload-files > li');
let li;
for (let i = 0; i < liElements.length; i++) {
if (liElements[i].getAttribute('data-file-name') === args.file.name) {
li = liElements[i];
}
}
return li;
},
onProgress: function (args) {
let progressValue = Math.round((args.e.loaded / args.e.total) * 100) + '%';
let li = this.getLiElement(args);
li.querySelector('.upload-status').innerHTML = args.file.status + '(' + progressValue + ' )';
},
onFileRemove: function (args) {
args.postRawFile = false;
}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
#container {
visibility: hidden;
padding-left: 5%;
width: 100%;
}
#loader {
color: #008cff;
font-family: 'Helvetica Neue', 'calibiri';
font-size: 14px;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.sf-icon-bmp:before {
content: "\e700";
}
.sf-icon-xlsx:before,
.sf-icon-XLSX:before {
content: "\e701";
}
.sf-icon-avi:before,
.sf-icon-AVI:before {
content: "\e702";
}
.sf-icon-doc:before,
.sf-icon-DOC:before {
content: "\e703";
}
.sf-icon-exe:before {
content: "\e704";
}
.sf-icon-mp4:before {
content: "\e705";
}
.sf-icon-zip:before,
.sf-icon-ZIP:before {
content: "\e706";
}
.sf-icon-tar:before {
content: "\e707";
}
.sf-icon-docx:before {
content: "\e708";
}
.sf-icon-jpg:before {
content: "\e709";
}
.sf-icon-png:before {
content: "\e70a";
}
.sf-icon-gif:before {
content: "\e70b";
}
.sf-icon-pdf:before {
content: "\e70c";
}
.sf-icon-txt:before {
content: "\e70d";
}
.sf-icon-jpeg:before {
content: "\e70e";
}
.sf-icon-xls:before {
content: "\e70f";
}
.sf-icon-mp3:before {
content: "\e710";
}
.customdroparea .e-upload {
border-top: none;
border-bottom: none;
}
.customdroparea .e-upload .e-upload-files {
border-top: none;
}
.customdroparea {
margin: auto 160px;
}
.customdroparea #dropArea .e-upload .e-upload-files .e-upload-file-list {
min-height: 0;
}
.customdroparea #drop {
padding: 6% 27% 6% 22%;
display: block;
border: 1px dashed #c3c3cc;
}
.customdroparea #drop a {
color: blue;
}
.highcontrast .customdroparea #drop a {
color: #ffd939;
}
.customdroparea #UploaderDropTarget {
min-height: 50px;
padding-top: 15px;
position: relative;
display: inline-block;
font-size: 13px;
top: -29px;
width: 400px;
}
.customdroparea .e-file-select-wrap {
display: none;
}
.customdroparea span.dropText {
position: relative;
left: 31%;
top: 101px;
}
.customdroparea .dropArea_wrap {
width: 400px;
height: 250px;
background-color: lightgrey;
display: inline-block;
margin: 22px;
border: 1px dashed grey;
}
.highcontrast .customdroparea .dropArea_wrap {
background-color: #000;
}
.customdroparea .font-icons {
position: relative;
top: 25%;
left: 32%;
width: 150px;
}
.customdroparea .upload-failed {
color: #d9534f;
}
.customdroparea .e-upload .wrapper .upload-success {
color: #107c10;
}
.customdroparea span.upload-status {
left: 45px;
position: relative;
font-size: 12px;
display: block;
padding: 5px;
top: -8px;
}
#UploaderDropTarget .e-upload .e-upload-files .e-file-reload-btn:hover,
#dropArea .e-upload .e-upload-files .e-file-reload-btn {
display: none;
}
#UploaderDropTarget .e-file-abort-btn.e-upload-progress {
background-image: none;
cursor: default;
opacity: .35;
}
#UploaderDropTarget .e-icons.e-file-delete-btn:hover {
background: none;
}
.customdroparea .e-upload .e-upload-files .e-file-remove-btn.e-icons,
.customdroparea .e-upload .e-upload-files .e-file-delete-btn.e-icons {
top: 50%;
}
@font-face {
font-family: 'FiletypeV2 Font';
src:
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1tSgIAAAEoAAAAVmNtYXDnYOfNAAAByAAAAFZnbHlmfTtllAAAAkgAACpgaGVhZBBa3XUAAADQAAAANmhoZWEH1AQTAAAArAAAACRobXR4SAAAAAAAAYAAAABIbG9jYWOGV2wAAAIgAAAAJm1heHABNQGCAAABCAAAACBuYW1l8fKKOQAALKgAAAKFcG9zdGQHrBsAAC8wAAAAkAABAAAEAAAAAFwEAAA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VkkDRE9DA0VYRQNNUDQDWklQA1RBUgRET0NYA0pQRwNQTkcDR0lGA1BERgNUWFQESlBFRwNYTFMDTVAzAAA=) format('truetype');
font-weight: normal;
font-style: normal;
}
[class^="sf-icon-"],
[class*=" sf-icon-"] {
font-family: 'FiletypeV2 Font' !important;
speak: none;
font-size: 35px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
top: 15px;
}
.customdroparea .ul-element {
list-style: none;
width: 100%;
padding-left: 0;
}
.customdroparea span.list-wrapper {
max-height: 400px;
display: block;
margin-left: 10px;
position: relative;
top: 2px;
}
.customdroparea .file-name {
padding: 8px 6px 5px 12px;
font-size: 13px;
width: 76%;
display: inline-block;
position: relative;
}
.customdroparea .file-size {
padding: 4px;
font-size: 13px;
width: 18%;
display: inline-block;
position: relative;
}
.customdroparea .file-lists {
border: 1px solid lightgray;
padding: 0 6px 0 14px;
margin-top: 15px;
position: relative;
background: rgba(0, 0, 0, 0.04);
}
.customdroparea .file-size,
.customdroparea .file-name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
/* csslint ignore:end */
</style>
Custom template
You can design the own template by preventing the default file list including buttons.
when you use custom template to upload or remove the files, pass the custom UI argument as true to call
upload / remove public method as follows:
-
UploaderObj.upload(filesData, true);
-
UploaderObj.remove(filesData, true);
Refer to the following code sample.
<template>
<div class="col-lg-8 control-section uploader template-view">
<div class="control_wrapper">
<div class="sample_wrapper">
<div id="dropTarget">
<span id="dropElement" class="droparea">Drop files here or <a href="" id="browse"><u>Browse</u></a>
</span>
<ejs-uploader id='template' name="UploadFiles" :asyncSettings="path" ref="uploadObj"
:dropArea="dropElement" :selected="onFileSelect" :progress="onFileUpload" :success="onUploadSuccess"
:failure="onUploadFailed" :removing="onFileRemove">
</ejs-uploader>
</div>
<div style="margin-left: 50px; padding-top:25px;">
<button class="e-btn e-css" id="clearbtn">Clear All</button>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { UploaderComponent as EjsUploader } from '@syncfusion/ej2-vue-inputs';
import { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
import { createElement, isNullOrUndefined, detach } from '@syncfusion/ej2-base';
import { onMounted, ref } from 'vue';
let filesDetails = [];
let parentElement = '';
let progressbarContainer = '';
const uploadObj = ref(null);
const path = {
saveUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Save',
removeUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Remove'
};
const dropElement = '#dropTarget';
const filesList = [];
onMounted(() => {
document.getElementById('browse').onclick = function () {
document.getElementsByClassName('e-file-select-wrap')[0].querySelector('button').click();
return false;
};
document.getElementById('clearbtn').onclick = () => {
if (!isNullOrUndefined(document.getElementById('dropTarget').querySelector('.upload-list-root'))) {
uploadObj.value.$el.value = '';
detach(document.getElementById('dropTarget').querySelector('.upload-list-root'));
uploadObj.value.filesDetails = [];
uploadObj.value.filesList = [];
}
};
});
const onFileSelect = (args) => {
if (isNullOrUndefined(document.getElementById('dropTarget').querySelector('.upload-list-root'))) {
parentElement = createElement('div', { className: 'upload-list-root' });
parentElement.appendChild(createElement('ul', { className: 'ul-element' }));
document.getElementById('dropTarget').appendChild(parentElement);
}
for (let i = 0; i < args.filesData.length; i++) {
formSelectedData(args.filesData[i]);
}
filesDetails = filesDetails.concat(args.filesData);
uploadObj.value.upload(args.filesData, true);
args.cancel = true;
};
const formSelectedData = (selectedFiles) => {
let liEle = createElement('li', { className: 'file-lists', attrs: { 'data-file-name': selectedFiles.name } });
liEle.appendChild(createElement('span', { className: 'file-name ', innerHTML: selectedFiles.name }));
liEle.appendChild(createElement('span', { className: 'file-size ', innerHTML: uploadObj.value.bytesToSize(selectedFiles.size) }));
if (selectedFiles.statusCode === '1') {
progressbarContainer = createElement('span', { className: 'progress-bar-container' });
progressbarContainer.appendChild(createElement('progress', { className: 'progress', attrs: { value: '0', max: '100' } }));
liEle.appendChild(progressbarContainer);
} else { liEle.querySelector('.file-name').classList.add('upload-fails'); }
let closeIconContainer = createElement('span', { className: 'e-icons close-icon-container' });
closeIconContainer.addEventListener('click', function (e) {
removeFiles(e);
});
liEle.appendChild(closeIconContainer); document.querySelector('.ul-element').appendChild(liEle);
filesList.push(liEle);
};
const onFileUpload = (args) => {
let li = document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');
let progressValue = Math.round((args.e.loaded / args.e.total) * 100);
if (!isNaN(progressValue)) {
li.getElementsByTagName('progress')[0].value = progressValue;
}
};
const onUploadSuccess = (args) => {
let li = document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');
if (!isNullOrUndefined(li.querySelector('.progress-bar-container'))) {
detach(li.querySelector('.progress-bar-container'));
}
if (args.operation === 'upload') {
li.querySelector('.file-name').classList.add('upload-success');
li.querySelector('.close-icon-container').classList.remove('remove-btn');
li.querySelector('.close-icon-container').classList.add('delete-icon');
(li.querySelector('.close-icon-container')).onclick = function () {
generateSpinner(li.querySelector('.close-icon-container'));
};
(li.querySelector('.close-icon-container')).onkeydown = function (e) {
if (e.keyCode === 13) {
generateSpinner(e.target.closest('.e-upload'));
}
};
}
if (args.operation === 'remove') {
filesDetails.splice(filesList.indexOf(li), 1);
filesList.splice(filesList.indexOf(li), 1);
detach(li);
hideSpinner(li.querySelector('.close-icon-container'));
detach(li.querySelector('.e-spinner-pane'));
}
};
const generateSpinner = (targetElement) => {
createSpinner({ target: targetElement, width: '25px' });
showSpinner(targetElement);
};
const onUploadFailed = (args) => {
let li = document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');
li.querySelector('.file-name').classList.add('upload-fails');
li.querySelector('.close-icon-container').classList.remove('remove-btn');
if (args.operation === 'remove') {
if (!isNullOrUndefined(li)) {
filesDetails.splice(filesList.indexOf(li), 1);
filesList.splice(filesList.indexOf(li), 1);
detach(li);
}
}
if (args.operation === 'upload') {
detach(li.querySelector('.progress-bar-container'));
}
};
const removeFiles = (args) => {
if (!isNullOrUndefined(args.currentTarget)) {
if (filesDetails[filesList.indexOf(args.currentTarget.parentElement)].statusCode === '2') {
uploadObj.value.remove(filesDetails[filesList.indexOf(args.currentTarget.parentElement)]);
} else {
onFileRemove(args);
}
}
};
const onFileRemove = (args) => {
args.postRawFile = false;
if (!isNullOrUndefined(args.currentTarget)) {
if (filesDetails[filesList.indexOf(args.currentTarget.parentElement)].statusCode !== '2') {
detach(args.currentTarget.parentElement);
filesList.splice(filesList.indexOf(args.currentTarget.parentElement), 1);
}
}
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
#container {
visibility: hidden;
padding-left: 5%;
width: 100%;
}
#loader {
color: #008cff;
font-family: 'Helvetica Neue', 'calibiri';
font-size: 14px;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#dropTarget {
min-height: 50px;
padding-top: 15px;
position: relative;
}
#clearbtn {
margin: 0px 0px 0px 30%;
}
#dropElement {
padding: 3% 28% 3%;
display: inherit;
border: 1px dashed #c3c3cc
}
.template-view .control_wrapper {
max-width: 400px;
margin: auto;
}
.template-view .e-file-select-wrap {
display: none;
}
.template-view .e-upload {
float: none;
border: none;
}
.template-view .ul-element {
list-style: none;
width: 100%;
padding-left: 0;
}
.template-view .file-name {
padding: 8px 6px 8px 0;
font-size: 13px;
width: 46%;
display: inline-block;
position: relative;
top: 4px;
}
.template-view .file-size {
padding: 4px;
font-size: 13px;
width: 18%;
display: inline-block;
position: relative;
}
.template-view .file-lists {
border: 1px solid lightgray;
padding: 0 6px 0 14px;
margin-top: 15px;
position: relative;
background: rgba(0, 0, 0, 0.04);
}
.template-view .file-size,
.template-view .file-name {
font-family: "Helvetica Neue", "Helvetica", "Arial", "sans-serif";
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.template-view span.progress-bar-container {
display: block;
float: right;
height: 20px;
right: 13%;
top: 14px;
position: relative;
width: 20%;
}
.template-view .progress {
width: 100%;
height: 15px;
-webkit-appearance: none;
}
.template-view .close-icon-container {
cursor: pointer;
font-size: 11px;
height: 24px;
margin: 0 12px 0 22px;
padding: 0;
position: absolute;
right: 0;
width: 24px;
top: 6px;
}
.template-view .close-icon-container.remove-btn {
display: none;
}
.template-view .close-icon-container.e-icons::before {
left: 7px;
position: inherit;
top: 7px;
content: '\e932';
}
.template-view .close-icon-container.delete-icon::before {
content: '\e94a';
}
.template-view .close-icon-container:hover {
background-color: rgba(0, 0, 0, 0.12);
border-color: transparent;
border-radius: 50%;
box-shadow: 0 0 0 transparent;
}
.template-view .upload-success {
color: #2bc700;
}
.template-view .upload-fails {
color: #f44336;
}
.template-view progress::-webkit-progress-bar {
border: 1px solid lightgrey;
background-color: #ffffff;
border-radius: 2px;
}
#dropTarget progress {
border: 1px solid lightgrey;
background-color: #ffffff;
border-radius: 2px;
}
.material .template-view progress::-webkit-progress-value {
border-radius: 2px;
background-color: #ff4081;
}
.material .template-view progress::-moz-progress-bar {
border-radius: 2px;
background-color: #ff4081;
}
.material #dropTarget span a {
color: #ff4081;
}
</style>
<template>
<div class="col-lg-8 control-section uploader template-view">
<div class="control_wrapper">
<div class="sample_wrapper">
<div id="dropTarget">
<span id="dropElement" class="droparea">Drop files here or <a href="" id="browse"><u>Browse</u></a>
</span>
<ejs-uploader id='template' name="UploadFiles" :asyncSettings="path" ref="uploadObj"
:dropArea="dropElement" :selected="onFileSelect" :progress="onFileUpload" :success="onUploadSuccess"
:failure="onUploadFailed" :removing="onFileRemove">
</ejs-uploader>
</div>
<div style="margin-left: 50px; padding-top:25px;">
<button class="e-btn e-css" id="clearbtn">Clear All</button>
</div>
</div>
</div>
</div>
</template>
<script>
import { UploaderComponent } from '@syncfusion/ej2-vue-inputs';
import { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
import { createElement, isNullOrUndefined, detach, EventHandler } from '@syncfusion/ej2-base';
export default {
name: "App",
components: {
"ejs-uploader": UploaderComponent
},
data: function () {
return {
path: {
saveUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Save',
removeUrl: 'https://services.syncfusion.com/vue/production/api/FileUploader/Remove'
},
dropElement: '#dropTarget',
filesList: [],
filesDetails: [],
parentElement: '',
progressbarContainer: ''
}
},
mounted: function () {
document.getElementById('browse').onclick = function () {
document.getElementsByClassName('e-file-select-wrap')[0].querySelector('button').click();
return false;
};
document.getElementById('clearbtn').onclick = () => {
if (!isNullOrUndefined(document.getElementById('dropTarget').querySelector('.upload-list-root'))) {
this.$refs.uploadObj.$el.value = '';
detach(document.getElementById('dropTarget').querySelector('.upload-list-root'));
this.$refs.uploadObj.filesDetails = [];
this.$refs.uploadObj.filesList = [];
}
};
},
methods: {
onFileSelect: function (args) {
if (isNullOrUndefined(document.getElementById('dropTarget').querySelector('.upload-list-root'))) {
this.parentElement = createElement('div', { className: 'upload-list-root' });
this.parentElement.appendChild(createElement('ul', { className: 'ul-element' }));
document.getElementById('dropTarget').appendChild(this.parentElement);
}
for (let i = 0; i < args.filesData.length; i++) {
this.formSelectedData(args.filesData[i]);
}
this.filesDetails = this.filesDetails.concat(args.filesData);
this.$refs.uploadObj.upload(args.filesData, true);
args.cancel = true;
},
formSelectedData: function (selectedFiles) {
let liEle = createElement('li', { className: 'file-lists', attrs: { 'data-file-name': selectedFiles.name } });
liEle.appendChild(createElement('span', { className: 'file-name ', innerHTML: selectedFiles.name }));
liEle.appendChild(createElement('span', { className: 'file-size ', innerHTML: this.$refs.uploadObj.bytesToSize(selectedFiles.size) }));
if (selectedFiles.statusCode === '1') {
this.progressbarContainer = createElement('span', { className: 'progress-bar-container' });
this.progressbarContainer.appendChild(createElement('progress', { className: 'progress', attrs: { value: '0', max: '100' } }));
liEle.appendChild(this.progressbarContainer);
} else { liEle.querySelector('.file-name').classList.add('upload-fails'); }
let closeIconContainer = createElement('span', { className: 'e-icons close-icon-container' });
let localObj = this;
closeIconContainer.addEventListener('click', function (e) {
localObj.removeFiles(e);
});
liEle.appendChild(closeIconContainer); document.querySelector('.ul-element').appendChild(liEle);
this.filesList.push(liEle);
},
onFileUpload: function (args) {
let li = document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');
let localObj = this;
let progressValue = Math.round((args.e.loaded / args.e.total) * 100);
if (!isNaN(progressValue)) {
li.getElementsByTagName('progress')[0].value = progressValue;
}
},
onUploadSuccess: function (args) {
let li = document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');
if (!isNullOrUndefined(li.querySelector('.progress-bar-container'))) {
detach(li.querySelector('.progress-bar-container'));
}
let localObj = this;
if (args.operation === 'upload') {
li.querySelector('.file-name').classList.add('upload-success');
li.querySelector('.close-icon-container').classList.remove('remove-btn');
li.querySelector('.close-icon-container').classList.add('delete-icon');
(li.querySelector('.close-icon-container')).onclick = function () {
localObj.generateSpinner(li.querySelector('.close-icon-container'));
};
(li.querySelector('.close-icon-container')).onkeydown = function (e) {
if (e.keyCode === 13) {
localObj.generateSpinner(e.target.closest('.e-upload'));
}
};
}
if (args.operation === 'remove') {
this.filesDetails.splice(this.filesList.indexOf(li), 1);
this.filesList.splice(this.filesList.indexOf(li), 1);
detach(li);
hideSpinner(li.querySelector('.close-icon-container'));
detach(li.querySelector('.e-spinner-pane'));
}
},
generateSpinner: function (targetElement) {
createSpinner({ target: targetElement, width: '25px' });
showSpinner(targetElement);
},
onUploadFailed: function (args) {
let li = document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');
let localObj = this;
li.querySelector('.file-name').classList.add('upload-fails');
li.querySelector('.close-icon-container').classList.remove('remove-btn');
if (args.operation === 'remove') {
if (!isNullOrUndefined(li)) {
this.filesDetails.splice(this.filesList.indexOf(li), 1);
this.filesList.splice(this.filesList.indexOf(li), 1);
detach(li);
}
}
if (args.operation === 'upload') {
detach(li.querySelector('.progress-bar-container'));
}
},
removeFiles: function (args) {
if (!isNullOrUndefined(args.currentTarget)) {
if (this.filesDetails[this.filesList.indexOf(args.currentTarget.parentElement)].statusCode === '2') {
this.$refs.uploadObj.remove(this.filesDetails[this.filesList.indexOf(args.currentTarget.parentElement)]);
} else {
this.onFileRemove(args);
}
}
},
onFileRemove: function (args) {
args.postRawFile = false;
if (!isNullOrUndefined(args.currentTarget)) {
if (this.filesDetails[this.filesList.indexOf(args.currentTarget.parentElement)].statusCode !== '2') {
detach(args.currentTarget.parentElement);
this.filesList.splice(this.filesList.indexOf(args.currentTarget.parentElement), 1);
}
}
}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
#container {
visibility: hidden;
padding-left: 5%;
width: 100%;
}
#loader {
color: #008cff;
font-family: 'Helvetica Neue', 'calibiri';
font-size: 14px;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#dropTarget {
min-height: 50px;
padding-top: 15px;
position: relative;
}
#clearbtn {
margin: 0px 0px 0px 30%;
}
#dropElement {
padding: 3% 28% 3%;
display: inherit;
border: 1px dashed #c3c3cc
}
.template-view .control_wrapper {
max-width: 400px;
margin: auto;
}
.template-view .e-file-select-wrap {
display: none;
}
.template-view .e-upload {
float: none;
border: none;
}
.template-view .ul-element {
list-style: none;
width: 100%;
padding-left: 0;
}
.template-view .file-name {
padding: 8px 6px 8px 0;
font-size: 13px;
width: 46%;
display: inline-block;
position: relative;
top: 4px;
}
.template-view .file-size {
padding: 4px;
font-size: 13px;
width: 18%;
display: inline-block;
position: relative;
}
.template-view .file-lists {
border: 1px solid lightgray;
padding: 0 6px 0 14px;
margin-top: 15px;
position: relative;
background: rgba(0, 0, 0, 0.04);
}
.template-view .file-size,
.template-view .file-name {
font-family: "Helvetica Neue", "Helvetica", "Arial", "sans-serif";
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.template-view span.progress-bar-container {
display: block;
float: right;
height: 20px;
right: 13%;
top: 14px;
position: relative;
width: 20%;
}
.template-view .progress {
width: 100%;
height: 15px;
-webkit-appearance: none;
}
.template-view .close-icon-container {
cursor: pointer;
font-size: 11px;
height: 24px;
margin: 0 12px 0 22px;
padding: 0;
position: absolute;
right: 0;
width: 24px;
top: 6px;
}
.template-view .close-icon-container.remove-btn {
display: none;
}
.template-view .close-icon-container.e-icons::before {
left: 7px;
position: inherit;
top: 7px;
content: '\e932';
}
.template-view .close-icon-container.delete-icon::before {
content: '\e94a';
}
.template-view .close-icon-container:hover {
background-color: rgba(0, 0, 0, 0.12);
border-color: transparent;
border-radius: 50%;
box-shadow: 0 0 0 transparent;
}
.template-view .upload-success {
color: #2bc700;
}
.template-view .upload-fails {
color: #f44336;
}
.template-view progress::-webkit-progress-bar {
border: 1px solid lightgrey;
background-color: #ffffff;
border-radius: 2px;
}
#dropTarget progress {
border: 1px solid lightgrey;
background-color: #ffffff;
border-radius: 2px;
}
.material .template-view progress::-webkit-progress-value {
border-radius: 2px;
background-color: #ff4081;
}
.material .template-view progress::-moz-progress-bar {
border-radius: 2px;
background-color: #ff4081;
}
.material #dropTarget span a {
color: #ff4081;
}</style>
You can also explore Vue File Upload feature tour page for its groundbreaking features. You can also explore our Vue File Upload example to understand how to browse the files which you want to upload to the server.