diff options
author | Marvin Borner | 2019-04-17 01:30:39 +0200 |
---|---|---|
committer | Marvin Borner | 2019-04-17 01:30:39 +0200 |
commit | b8e81e52f4e12186455b6d17b378f29383d7ce88 (patch) | |
tree | 585fe42fc6966d5f3f74decf6af5b25ee40bc83a /src/main/kotlin | |
parent | 1b790423c46498b96ad2cd0671114226c9941f9f (diff) |
Added directory uploading template
Co-authored-by: LarsVomMars <lars@kroenner.eu>
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/DatabaseController.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/FileController.kt | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/kotlin/DatabaseController.kt b/src/main/kotlin/DatabaseController.kt index 7b229f4..c21b175 100644 --- a/src/main/kotlin/DatabaseController.kt +++ b/src/main/kotlin/DatabaseController.kt @@ -18,7 +18,7 @@ class DatabaseController(dbFileLocation: String = "main.db") { val id = integer("id").autoIncrement().primaryKey() val path = text("path").uniqueIndex() val userId = integer("userId").references(UserData.id) - val accessId = varchar("accessId", 64).uniqueIndex() // TODO: Add file sharing + val accessId = varchar("accessId", 64).uniqueIndex() val isShared = bool("isShared").default(false) } diff --git a/src/main/kotlin/FileController.kt b/src/main/kotlin/FileController.kt index 528df3a..5586212 100644 --- a/src/main/kotlin/FileController.kt +++ b/src/main/kotlin/FileController.kt @@ -111,8 +111,11 @@ class FileController { */ fun upload(ctx: Context) { ctx.uploadedFiles("file").forEach { (_, content, name, _) -> - val path = "${ctx.splats()[0]}/$name" - FileUtil.streamToFile(content, "$fileHome/${userHandler.getVerifiedUserId(ctx)}/$path") + val path = "${ctx.splats()[0]}/$name" // es gibt kein [content] bei nem dir + FileUtil.streamToFile( + content, + "$fileHome/${userHandler.getVerifiedUserId(ctx)}/$path" + ) // ich würde alle files aus der directory einzeln uploaden <- deshalb das (foreach) databaseController.addFile(path, userHandler.getVerifiedUserId(ctx)) } } |