Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mounted() {
// If this file input is inside a collection, we can allow multi-upload.
this.multiFileCollectionRow = this.findClosestCollectionRow(this.$el);
// Init upload element.
let t = this;
let uploader = UIkit.upload(this.$el, {
multiple: this.multiFileCollectionRow,
name: 'file',
type: 'PUT',
allow: '*.' + (this.fileTypes ? this.fileTypes : '*').split(',').join('|*.'),
beforeAll: () => {
this.error = null;
this.loading = true;
},
completeAll: () => {
this.fileName = this.tmpFileName;
this.fileSize = this.tmpFileSize;
this.fileType = this.tmpFileType;
this.fileId = this.tmpId;
this.checksum = this.tmpChecksum;
mounted() {
let vm = this;
let id = "div[property=" + vm.field.name + "] > div[uid='" + vm._uid + "'] .js-upload";
let upload = document.querySelector(id);
UIkit.upload(upload, {
url:
Utils.url +
"/uploads" +
"?maximumFileSize=" +
vm.field.maximumFileSize +
"&allowedMimeType=" +
encodeURIComponent(vm.field.allowedMimeType),
name: "files",
multiple: false,
msgInvalidMime: "Invalid file type, must be %s",
mime: vm.field.allowedMimeType,
error: function (response) {
if (response.xhr == null) {
mounted() {
UIkit.upload('.js-upload', {
url: this.url,
method: "POST",
name: "tasks",
beforeSend: function (environment) {
environment.headers['X-CSRF-TOKEN'] = window.axios.defaults.headers.common['X-CSRF-TOKEN'];
},
beforeAll: function () {
this.importing = true;
},
completeAll: function () {
this.importing = false;
window.location.reload(true);
}
});
}
}