http.sh/webroot/upload/index.shs

19 lines
529 B
Bash
Executable File

#!/bin/bash
source templates/head.sh
domainprefix="https://f.megumin.tech/"
if [[ ${post_multipart} != '' ]]; then
for i in ${post_multipart[@]}; do
asdf=$(mktemp -p $(dirname ${r[uri]}) XXX)
relative=$(realpath --relative-to "$(dirname ${r[uri]})" $asdf)
mv "$i" $asdf
rm "$i"
echo "<a href='$domainprefix$relative'>Your uploaded file</a>"
done
else
echo '<form enctype="multipart/form-data" method="POST">
<input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>'
fi