I have a function in mod_python that's supposed to take a jpeg uploaded from an HTML form and put it on the server. Here's what I've got (and it doesn't work):
Code:
formdata = util.FieldStorage(req)
pictureFile = formdata["pictureFile"].file
file = open("img/" + itemID + ".jpg", "w")
file.write(pictureFile)
file.close()
os.system("convert img/" + itemID + ".jpg -resize 100x100 -write img/" + itemID + "Thumb.jpg")
I get the following error when I run this function:
Code:
KeyError: 'pictureFile'
This is in reference to the very first line. I assume the key exists because this is the HTML that describes the form field:
Code:
<input type="file" name="pictureFile" accept="image/jpg,jpeg" />
Any ideas? I think what I'm trying to do is pretty basic. For the record, apache *does* have write permission on this directory, and this app is *not* visible from the Internet at large
