[Zope] Zope/python: downloading images from the web and add them to Zope

BonviciniJ at keops.net BonviciniJ at keops.net
Fri Apr 8 09:14:53 EDT 2005


I would like to know how to add image file from an URL.
I created a form with to pissibilities: add an image from a local file , and a image from an url

here is my form:
<input type="radio" name="sourcePicture" checked onClick="lock_option()" value="file">
get from disk: <input type="file" name="pict_file" size="40" accept="image" maxlength=500000>

<br>

<input type="radio" name="sourcePicture" onClick="lock_option()" value="internet">
get from the internet<input type=text name="pict_internet" size="40" value="http://www.monsite.fr/monimage.jpg" disabled="disabled">

This form call a python script:

if REQUEST.sourcePict=="file":
     pathImgs.manage_addProduct['OFSP'].manage_addImage("pict_"+id, REQUEST.pict_file, title="pictogramme metier", precondition="", content_type="")
else:
    pathImgs.manage_addProduct['OFSP'].manage_addImage("pict_"+id, REQUEST.pict_internet, title="pictogramme metier", precondition="", content_type="")


With a locl file it works (case sourcePict=file), but when I want to add images from an url, it doesn't work.
I suppose that the second parameter of manage_addImage must be a file type.In the first case, it works , but in the second, the parameter passed is a string (complete url of the image).
so how to do?

thanks for your answers and excuse me for the lack in English (I'm french)


More information about the Zope mailing list