At 14.48 03/04/2003 +0000, you wrote:
Hi all, How can I upload an image through Python script(external method also ok) in zope, with out using any html form...
ie) I have a file in my servers folder.... Just I want to add this to zope... I dont have any html form to browse file....
hope somebody will help me bi from saravanan annamalai
Hy, I just solved this problem some days ago BUT for a text file (but this is not problem in my opinion). The code for ExternalMethod is: #Load a file from Server FSO in Zope without using form def main(self, fileName): #Directory on FSO that contains yhe image to upoload myDir='C:\\temp\\' #Read file from directory (please try use 'r' vs.'rb' to NOT read in binary mode) f = open(myDir+fileName, 'rb') data = f.read() f.close() del f #Set the folder (''testZopeFolder') in which I want upload the file (from the context of ExternalMethod) obj=self.restrictedTraverse('testZopeFolder/') #File upload (please note to set the content-type property) obj.manage_addFile('fileID',data, content_type=''set the content-type...img/...') del data return true OK? Write me if you have some problems... Bye, Mau ps: a special thanks to Michele Zanotti!