On Wed, Dec 05, 2001 at 08:16:10AM -0800, sanjeev c s wrote:
Hello friends, i have a form which uploads a file. and it calls a method which pass parameter to a python script. this python script creates a 'file object'.
Now the python script creates a 'file object' even if file is not uploaded in the form. so in the script i want to have a condition,
if picture: container.foldername.manage_addImage(id=id, file=picture)
but still even if the file is not uploaded the 'file object' is created. what is the problem ??
When you submit an upload form, you always get the file object, even if it's empty. But if the user didn't give a filename in the form, you can test for that like so: if picture.filename: container.foldername.manage_addImage(id=id, file=picture) This works because picture.filename will be an empty string if they didn't provide a name. -- paul winkler home: http://www.slinkp.com music: http://www.reacharms.com calendars: http://www.calendargalaxy.com