title: Python file upload "KeyError"
body: <p>Whats wrong in this code?</p>
  
  <p>Here is my HTML:</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
  &lt;form action="iindex.py" method="POST" enctype="multipart/form-data"&gt;
  &lt;p&gt;File: &lt;input type="file" name="ssfilename"&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input type="submit" value="Upload" name="submit"&gt;&lt;/p&gt;
  &lt;/form&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>This is my Python script:</p>
  
  <pre><code>#! /usr/bin/env python
  import os, sys;
  from mod_python import apache
  import cgi
  import cgitb; cgitb.enable()
  
  form = cgi.FieldStorage(keep_blank_values=1)
  fileitem = form["ssfilename"]
  .....
  </code></pre>
  
  <p>This is the line where I get KeyError.</p>
  
  <pre><code>File "/Applications/MAMP/python/framework/Python.framework/Versions/2.6/lib/python2.6/cgi.py", line 541, in __getitem__
  raise KeyError, key
  
  KeyError: 'ssfilename'
  </code></pre>