Purging incomplete documentation of BCHS uploading script

OBSD-7.1-cur httpd cgi YASM


what's BCHS? and why? too much of time in hand and willingness to self harm (-_-

This is archived post - work in progress

Last week I was asked by my friend how I'm uploading photos from phone to this server, it was bit of not soo user friendly process. I tather phone + pc together and run ftp server on phone so I could connect and download with pc then scp to the public directory here. Since I have moved out of my den very recently I'm meeting new people; having interaction, sharing things and it has reached a point I'm finding it troublesome of this repitative upload cycle.

In the past, I came across a cgi script having a web form wrapper to upload documents. It was from a user on tilde.institute. I should have stolen the script that time!

        location "/cgi/*.cgi" {
                root "/htdocs/cgi/"
                request strip 1
                fastcgi {
                        param SCRIPT_FILENAME "/htdocs/cgi/test.cgi"

        location "/cin/*" {
                root "/htdocs/cin/"
                request strip 1
                directory auto index 



cat > $file

filename1=$(head -2 $file | sed 's/^.*filename=//' | sed 's/\"//g' | sed 's/.$//' | tail -1)

lines=$(($(wc -l < $file)))

head -n $((lines - 1)) $file | tail -n $((lines - 5)) > /htdocs/dump_displ/$filename1

cat <<EOF
<h1>Upload Successful https://displ.nl/pub_listing/$filename1</h1>

exit 0


<html><head><title>Test Form</title></head>

<form action="../cgi/test.cgi" enctype="multipart/form-data" method="post">
        <label class="custom-uploader" for="file">Upload Your File</label> 
        <input id="file" accept="image/jpeg,image/gif,image/png,application/pdf,image/x-eps" name="fileToUpload" type="file" /> 
        <button class="btn btn-success" name="submit" type="submit"> Upload File </button>