From 1ceb1ca02e8cc1a55443152b8505e3949007ce54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 15 Apr 2022 14:30:02 +0200 Subject: [PATCH] basic attachment upload --- attachment.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/attachment.sh b/attachment.sh index d004b0d..9b5d545 100755 --- a/attachment.sh +++ b/attachment.sh @@ -63,8 +63,13 @@ attachment_convert(){ if [ "${PATH_INFO%/\[attachment\]/}" != "${PATH_INFO}" ]; then . "$_EXEC/multipart.sh" if multipart_cache; then - debug 'Multipart "file":' - multipart file |hd |debug >/dev/null + mkdir -p "$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/" + n=1; while filename=$(multipart_filename "file" "$n"); do + filename="$(printf %s "$filename" |tr /\\0 __)" + multipart "file" "$n" >"$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/$filename" + n=$((n + 1)) + done + rm -- "$multipart_cachefile" REDIRECT "${_BASE}${PATH_INFO}" else theme_attachments "${PATH_INFO%\[attachment\]/}" -- 2.39.2