Creation of a simple HTML file upload page

Viewed 15400

First, I don't need any functions more than upload a file. No progress bar, no file type, or size check, no multiple files.

What I want is the most simple HTML webpage to handle the upload and save the file with the name I specified.

I tried to use this:

<form action="../cgi-bin/upload.py" method="post" enctype="multipart/form-data">
<input type="file" name="upload" />
<input type="submit" /></form>

In upload.py:

#!/usr/bin/python

import os
import commands
import cgi, cgitb

cgitb.enable()
print "Content-Type: text/html"
print
print 'start!'
form = cgi.FieldStorage()
filedata = form['upload']

But I don't know how to save this in file, like "Beautiful.mp3".

Can any body help?

Though, really, I don't want to use any scripts. I just want the most basic html pages. Python scripts will only exist when there must be some CGI handlers. Flash is not preferred.

1 Answers
Related