[Zope] Upload method for a xmldocument!

Stephen Pitts smpitts@midsouth.rr.com
Mon, 13 Mar 2000 15:14:15 -0600


--0F1p//8PRICkK4MW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Mar 13, 2000 at 01:04:32PM +0100, Anders Holmbech Nielsen wrote:
> hi,
> 
> Does anyone have a solution to, or know where I can find one to how I 
> can upload a ordinary xml dokument to my Zope without any user 
> interaction ?
> 

I use the attached script to batch-upload directories of jpegs as Photo
objects, so it should be a good start.
--
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org

--0F1p//8PRICkK4MW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="classic_uploadphotos.py"

from urllib import urlopen, urlencode
from sys import argv

url = "http://www.centralchurchyouth.org:8100/Photos/%s/manage_addProduct/Photo/manage_addPhoto" % argv[1]

for filename in argv[2:]:
	args = {}
	args['file'] = open(filename).read()
	args['id'] = filename
	args['title'] = filename
	args = urlencode(args)
	urlopen(url, args)
	print filename

--0F1p//8PRICkK4MW--