summaryrefslogtreecommitdiff
path: root/tmp-upload
diff options
context:
space:
mode:
Diffstat (limited to 'tmp-upload')
-rwxr-xr-xtmp-upload10
1 files changed, 7 insertions, 3 deletions
diff --git a/tmp-upload b/tmp-upload
index 670a2e5..e72f98f 100755
--- a/tmp-upload
+++ b/tmp-upload
@@ -11,9 +11,12 @@ if [ -n "$1" ]; then
fi
fi
-out="$(mktemp /tmp/tmp-upload-php.XXXXXXXX)"
+# Temporary directory for storing uploads and PHP script
+tmpdir="$(mktemp -d)"
+
+out="$tmpdir/upload.php"
cleanup() {
- rm -v "$out"
+ rm -rvf "$tmpdir"
}
trap cleanup EXIT
@@ -22,7 +25,8 @@ startline=$(grep -hn -F -m 1 "# stuff ""below" "$0" | cut -d: -f1)
tail -n+$((startline+1)) "$0" > "$out"
php -d post_max_size=128M -d upload_max_filesize=128M \
- -d open_basedir="$out:$(pwd)/" \
+ -d upload_tmp_dir="$tmpdir/" \
+ -d open_basedir="$tmpdir/:$(pwd)/" \
-S "$host:$port" "$out"
exit
# stuff below