Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-12-2005, 05:33 PM   #1
LQ Newbie
Registered: Apr 2005
Posts: 20

Rep: Reputation: 1
mod_python: Handling Uploads from HTML Form

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):

formdata = util.FieldStorage(req)
pictureFile = formdata["pictureFile"].file

file = open("img/" + itemID + ".jpg", "w")

os.system("convert img/" + itemID + ".jpg -resize 100x100 -write img/" + itemID + "Thumb.jpg")
I get the following error when I run this function:

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:

<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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Html Form File Cottsay General 0 11-05-2005 01:30 PM
html question: form henrikanttonen Programming 4 08-13-2004 07:28 AM
Contact form on HTML Gerardoj Linux - General 1 03-26-2004 02:08 AM
an html form question matt_w_lambert Programming 3 10-30-2003 11:41 PM
problem with html form meluser Linux - Software 4 03-15-2003 12:28 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration