Hello,
I'm writing a simple cgi script and want to be able to access the filename in a FieldStorage file instance. I have successfully manmaged to access the file as a 'file-like object' by using the simple code of :
objInFile = objForm['DataFile'].file
I can easily read through this data and get all the information out as I need - sorted!! However, when I attempt to access the filename attribute of this using :
print 'Content-Disposition: attachment; filename="' + os.path.split(objForm['DataFile'].filename)[0] + '_reformatted.txt"'
I get None back for the filename. So I dumped the content of the objForm['DataFile'] to stdout to see what it contains :
print objForm['DataFile']
I got back this :
FieldStorage('DataFile', 'MOAF_10-12_fin_2.txt', 'Project\tJob\tBarcode\tPlate set <blaahh, blaaahh, blahh>)
As you can see, when __str__ is called, the FieldStorage is displaying the name of the client side file - so it knows what it is, however when I call .filename on it, I get None. I don;t get what is happening here - has anyone else seen this and/or knows what I'm doing wrong?
If so then all and any help would be much appreciated.
Cheers,
Neil
--
Neil Benn Senior Automation Engineer Cenix BioScience BioInnovations Zentrum Tatzberg 46 D-01307 Dresden Germany
Tel : +49 (0)351 4173 154 e-mail : [EMAIL PROTECTED] Cenix Website : http://www.cenix-bioscience.com
-- http://mail.python.org/mailman/listinfo/python-list