Jonathan Bryant writes:
I've been playing around with Zope for several days and really like it. I'm amazed at how simple so many things that take alot of effort in php, asp etc. are amazingly simple in Zope. One of those things is file upload,... .... What I'd like to do is easily grab the filename:
context.manage_addProduct['OFSP'].manage_addFile(item.filename, item_title, item) This should work as you write it here.
My question is, how do I get the filename or headers? I'm guessing that when I reference 'item' I'm getting a FileUpload object. Right!
What confuses me is that I can't reference item.filename or item.headers['Content-Type']. I've also tried using REQUEST['item'].filename like I've seen in several examples. All of these should work!
The access to "headers" may throw an "Unauthorized" exception because in former Zope versions, a security declaration was missing (not sure about the current version). What happens for you: an "Unauthorized" exception, an "AttributeError", or what? We always want good problem descriptions. Such descriptions contain "Error Type", "Error Value" and usually (at least) the last part of the resulting traceback! Dieter