From 464991b62e4fa6141449ca0c5980fcf0af3097a6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 23 Feb 2021 20:31:19 +0100 Subject: upload files and write to disk --- themes/okadmin/public/js/upload.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'themes/okadmin/public/js/upload.js') diff --git a/themes/okadmin/public/js/upload.js b/themes/okadmin/public/js/upload.js index d300dac..40c6fa7 100644 --- a/themes/okadmin/public/js/upload.js +++ b/themes/okadmin/public/js/upload.js @@ -34,7 +34,7 @@ OKUpload.prototype.parse = function (url) { if (!url) return; var uploader = this; Parser.parse(url, function (media) { - console.log(url, media); + // console.log(url, media); if (!media) { alert("Not a valid link"); } else if (media.type == "image") { @@ -88,6 +88,12 @@ OKUpload.prototype.upload = function (f) { } field = "audio"; action = this.audioAction; + } else if (f.type.match("application.*") || f.type.match("text.*")) { + if (this.config.fileMaxbytes && f.size > this.config.fileMaxbytes) { + return this.largeFileError(f, this.config.fileMaxbytes); + } + field = "file"; + action = this.fileAction; } else { if (this.config.imageMaxbytes && f.size > this.config.imageMaxbytes) { return this.largeFileError(f, this.config.imageMaxbytes); @@ -136,7 +142,7 @@ OKUpload.prototype.upload = function (f) { console.log("ERROR PARSING JSON"); } } - console.log(arguments, request); + // console.log(arguments, request); } function transferError(data) { console.log("Transfer error"); @@ -148,7 +154,7 @@ OKUpload.prototype.upload = function (f) { console.log("Transfer aborted"); this.loadCount += 1; this.hideUploadBars(); - console.log(arguments); + // console.log(arguments); } request.send(fd); -- cgit v1.2.3-70-g09d2