Thanks for the responses. My first message was a little unclear...
Here is what I am doing in more detail:
On the client side (me), I have a windows machine, and I am uploading a
On the server, I am running Zope on Linux. My upload form looks like this:
<form method="post" action="Customize" enctype="multipart/form-data">
<input type="file" name="attached_file">
So I use this form, and I think the file gets uploaded, though I'm not quite
sure where it goes. The "Customize" DTML gets called when the form is
submitted, it looks like this:
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
filename: <dtml-var "get_file_name(REQUEST)">
And the "get_file_name" is a Python External Method, which looks like this:
s = REQUEST.form['attached_file'].filename
Everything works great so far.
Now I want to do something with that file I just uploaded.
What is its name on the server?
The "filename" in the field I am pretty sure is NOT the name of the file on
the local system, since when I look at it, it says "E:\test\myfile" and this
is on a Linux system, so there is no such path. That is the name file had
on my Windows system.
What sort of object is this "REQUEST.form['attached_file']"? Is there some
way to find out this sort of thing when you have a Python object? (I'm new
Is that even the place to look to get the name of the file on the server
after it is uploaded?
That's why I mentioned the quote from that How-To (which the above is
basically a copy of): "In you python external method you can now reference
REQUEST.form['attached_file'] as a normal file. You can perform things such
as read() on the object. "
This makes it seem like whatever is necessary, it is very easy, but there's
some detail that I am missing. Maybe I just don't know what a "normal file"
Dieter Maurer wrote:
> Joh Johannsen writes:
> > But it says: "In you python external method you can now reference
> > REQUEST.form['attached_file'] as a normal file. You can
> > perform things such as read() on the object. "
> > Now in my Python external method, I can reference things like:
> > REQUEST.form['attached_file'].filename
> > and that is fine.
> > But what is the syntax for actually reading the file? From the above
> > quote I thought it was as simple as
> > x=REQUEST.form['attached_file'].read() but that doesn't work...
> Please tell us, how it does not work (in fact, it should work):
> Did you get an attribute error (read) or was the result wrong?
> You must use the 'enctype="multipart/form-data"' and
> 'method=post' form parameter to upload files. Did you do that?
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -