#!/pkg/gnu/bin/gawk -f
BEGIN {
print "Content-type: text/html"
print ""
if (0) showfile()
else {
getfile()
print ""
print "
"
}
}
function showfile() {
print "
"
while (getline) {
print $0 # length($0)
}
}
function getfile( delim,n) {
getline delim
while (getline) {
if ($0 ~ /Content-Disposition/) {
++n
getline # image type
getline # empty
while (getline) {
if ($0 ~ delim) break
else print > ("uploadedfile"n)
}
}
}
}