add todos

This commit is contained in:
Jakob Ketterl 2021-02-08 23:30:44 +01:00
parent a1c024bfe2
commit 4df5f19bd6
2 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@ $.fn.imageUpload = function() {
input.onchange = function(e) { input.onchange = function(e) {
var reader = new FileReader() var reader = new FileReader()
// TODO: implement file size check
reader.readAsArrayBuffer(e.target.files[0]); reader.readAsArrayBuffer(e.target.files[0]);
reader.onload = function(e) { reader.onload = function(e) {
$.ajax({ $.ajax({

View File

@ -4,6 +4,7 @@ import uuid
import json import json
# TODO: implement authorization
class ImageUploadController(AssetsController): class ImageUploadController(AssetsController):
def __init__(self, handler, request, options): def __init__(self, handler, request, options):
super().__init__(handler, request, options) super().__init__(handler, request, options)
@ -26,6 +27,7 @@ class ImageUploadController(AssetsController):
def processImage(self): def processImage(self):
self.uuid = uuid.uuid4().hex self.uuid = uuid.uuid4().hex
# TODO: limit file size
contents = self.get_body() contents = self.get_body()
with open(self.getFilePath(), 'wb') as f: with open(self.getFilePath(), 'wb') as f:
f.write(contents) f.write(contents)