From 2f93cce4dc3e659ce11ccae93fb256cec1258062 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 9 Oct 2013 11:41:15 +0200 Subject: tmp-upload: fix upload when open_basedir is set --- tmp-upload | 10 +++++++--- 1 file 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 -- cgit v1.2.1