#!/usr/bin/env python3 import cgi import sys form = cgi.FieldStorage() data = form.getvalue('data') sys.stdout.write( 'Content-Type: text/html; charset=UTF-8\r\n\r\n' '\n' '\n' '\n' '\n' '\n' '

This tests verifies the test file included in the multipart form data:

\n' '
\n'
)

if data:
    sys.stdout.write(
        'PASS: File is present\n'
        'PASS: File upload was successful\n'
    )

    if len(data) > 0:
        print('PASS: File size is greater than 0')
    else:
        print('FAIL: File size is 0')
else:
    sys.stdout.write(
        'FAIL: File is missing\n'
    )

sys.stdout.write(
    '
\n' '\n' '\n' )