[Zope] localfs image upload

Michel Vayssade michel.vayssade@utc.fr
Thu, 18 Oct 2001 14:52:58 +0200 (MET DST)


On Thu, 18 Oct 2001, Brett Kiellerop wrote:
> In my current code to upload an image, I call a method which contains:
> <dtml-call "manage_addImage(REQUEST['id'], REQUEST['file'], REQUEST
> ['title'])" >
> <dtml-var upload1sql>
> <p><font size="3" face="Arial, Helvetica, sans-serif" color="black">File
> uploaded successfully</p>
> 
> I would like to move the images to a localfs I have called images. Any
> ideas how I would change the code above to get it to save the uploaded
> image in the images localfs and not in the ZODB?

I do the reverse, but it can help :

try something like
<dtml-call "putfile('filename',data)">

where putfile is the name of an external method looking like :
(here is a getfile external method I used :)

#getfile external method 
from os.path import exists
file = 'Extensions/test'
def readfile(file=file):
  if (exists(file)) :
    fd = open(file, 'r')
    lines = fd.read()
    fd.close()
    return lines
  else :
    return "*** Fichier "+file+" non trouvé."


--
  _/   _/ _/_/_/  _/_/ Michel.Vayssade@UTC.fr    Service Informatique
 _/   _/   _/  _/      T:33/0-3.44.23.49.24 Universite de Technologie
_/   _/   _/  _/       F:33/0-3.44.23.46.77 BP 20.529 60205 Compiegne
 _/_/    _/    _/_/    _ mv@utc.fr __/www.utc.fr/~vayssade____ France