John Mudd
JohnMudd at mindspring.com
Fri May 7 05:43:03 EST 2004
Perfect timing! I just found that thread myself via Gogle and I just checked my 3.1.3 version of util.py. It seems to contain the correct code. Here it is: def __getitem__(self, key): """Dictionary style indexing.""" if self.list is None: raise TypeError, "not indexable" found = [] for item in self.list: if item.name == key: if isinstance(item.file, FileType): found.append(item) else: found.append(StringField(item.value)) if not found: raise KeyError, key if len(found) == 1: return found[0] else: return found I added debug code inside this method and here are the results: item=Field('inputJar', 'zopeIntro.txt') item.type='text/plain' item.type_options={} type(item)=<type 'instance'> Someone else mad a suggestion that I'm not setting my content_type correctly. Here's what I'm using. def handler(req): req.content_type = 'text/html' I tried switching to req.content_type = 'multipart/form-data'. That did have an effect. Now I get a popup from my browser asking if I want to save the file or open it with an application. Any suggestions? On Fri, 2004-05-07 at 05:04, Volodya wrote: > On Thu, May 06, 2004 at 01:21:29PM -0400, John Mudd wrote: > > (Sorry if you see this msg twice. I submitted this earlier today by under a non-member email address.) > > > > I'm trying to upload a file. I specified a "file" type input field in my HTML, it displays as expected with the "Browse..." button, I'm able to select a file but... > > > > When I look in the FieldStorage dictionary for the field I only get a String type field that is the file name. I was expecting a "Field" type object that would provide access to the file name and contents. > > > > What am I missing? > > Check this thread : > > http://www.modpython.org/pipermail/mod_python/2004-March/015224.html > > > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|