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 --- examples/db.json | 12 ++++++++++++ examples/index.js | 12 +++++++++++- examples/templates/index.liquid | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/db.json b/examples/db.json index 34304c9..11204e7 100644 --- a/examples/db.json +++ b/examples/db.json @@ -328,5 +328,17 @@ "dateCreated": "Sat, 31 Dec 2016 05:07:09 GMT", "images": [] } + ], + "filez": [ + { + "id": "pdf-upload", + "title": "PDF upload", + "file": { + "uri": "/uploads/1e/Typhon firmware v3.pdf", + "caption": "/uploads/1e/Typhon firmware v3.pdf" + }, + "__index": 0, + "dateCreated": "Tue, 23 Feb 2021 19:30:32 GMT" + } ] } \ No newline at end of file diff --git a/examples/index.js b/examples/index.js index f08c752..729c574 100644 --- a/examples/index.js +++ b/examples/index.js @@ -69,6 +69,11 @@ var app = okcms image: { type: "image" }, images: { type: "triple-captioned-image-list" }, }, + filez: { + id: { type: "string", hidden: true }, + title: { type: "string" }, + file: { type: "file" }, + }, }, resources: [ @@ -77,6 +82,7 @@ var app = okcms { type: "bread" }, { type: "test" }, { type: "flour" }, + { type: "filez" }, ], services: { @@ -85,6 +91,10 @@ var app = okcms secret: process.env.S3_SECRET, bucket: process.env.S3_BUCKET, dirname: "okcms-example", + local: { + localPath: "/Users/user/Sites/okcms/examples/public/uploads/", + remotePath: "/uploads/", + }, image: { allowed: true, preserveFilename: false, @@ -163,7 +173,7 @@ var app = okcms "/contact": { data: { type: "page", query: "contact" }, }, - "/:id": { + "/bread/:id": { data: { type: "bread", query: ":id" }, }, }, diff --git a/examples/templates/index.liquid b/examples/templates/index.liquid index 7c12a86..4f26378 100644 --- a/examples/templates/index.liquid +++ b/examples/templates/index.liquid @@ -12,7 +12,7 @@