----- Original Message -----
Sent: Monday, March 25, 2002 5:47
PM
Subject: Re: [Zope] How to upload files
and create file objects from DTML page?
in the method (probably a python script) dealing
with the upload use the following
I patched it from several of my methods. It is
not tested but it should give you the idea
Robert
Call this function as a the action of a file
upload form.
If it is in a python script just leave out the
def part, and give the script the
parameter file.
def manage_addMyFile ( self,
file ) :
""" add file
"""
import
os
if
hasattr(file,'filename'):
filename=file.filename
title=filename
id=filename[max(string.rfind(filename,
'/'),
string.rfind(filename,
'\\'),
string.rfind(filename,
':'),
)+1:]
if(file):
if(os.path.splitext(filename)[1] in ['.jpg',
'.gif']):
self.manage_addImage(id, title,
file)
if
other extention ....
----- Original Message -----
Sent: Monday, March 25, 2002 2:46
AM
Subject: [Zope] How to upload files and
create file objects from DTML page?
I want to have a normal DTML page for users that
allows them to upload and download files (without needing to use
the management interface). The downloading and display of files is fine, but
I cant figure out the zope/python code to create a new file object and
store an uploaded file. The files could be upto ~60MB in size, and can
be zip or doc files etc. Has anyone seen suitable sample code for
this?