[Zope] Re: How to get the path?
Josef Meile
jmeile@hotmail.com
Mon, 10 Mar 2003 20:58:50 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0010_01C2E747.D9D3B5E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
--- In zope@yahoogroups.com, Sorin Marti <mas@s...> wrote:
> Hi all,
>=20
> I want to upload files to the filesystem on my server (not into zope's =
> Data.fs)
>=20
> With <input type=3D"file" name=3D"file"> I get the filename...right?
>=20
> But If I want to copy it with an external method like this:
>=20
> copy =3D os.system('cp %s /tmp' %file.filename)
>=20
> it doesent work because file.filename is only the file but not the=20
> path... (for example test.pdf)
>=20
> How do I get the path?
I think you're asking the wrong question. I suppose what you
want to know is how to get the file content. You have to do
something like this:
fileContent=3Dcontext.REQUEST.form['file'].read()
Then, you have to take a look at the localfs dtml methods to
see how a file is created in the local file system.
Regards,
Josef
------=_NextPart_000_0010_01C2E747.D9D3B5E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>--- In <A=20
href=3D"mailto:zope@yahoogroups.com">zope@yahoogroups.com</A>, Sorin =
Marti <<A=20
href=3D"mailto:mas@s">mas@s</A>...> wrote:<BR>> Hi all,<BR>> =
<BR>> I=20
want to upload files to the filesystem on my server (not into zope's =
<BR>>=20
Data.fs)<BR>> <BR>> With <input type=3D"file" name=3D"file"> =
I get the=20
filename...right?<BR>> <BR>> But If I want to copy it with an =
external=20
method like this:<BR>> <BR>> copy =3D os.system('cp %s /tmp'=20
%file.filename)<BR>> <BR>> it doesent work because file.filename =
is only=20
the file but not the <BR>> path... (for example test.pdf)<BR>> =
<BR>>=20
How do I get the path?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I think you're asking the wrong =
question. I suppose=20
what you</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>want to know is how to </FONT><FONT =
face=3DArial=20
size=3D2>get the file content. You have to do</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>something like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>fileContent=3Dcontext.REQUEST.form['file'].read()<BR></FONT></DI=
V>
<DIV><FONT face=3DArial size=3D2>Then, you have to take a look at=20
the localfs dtml </FONT><FONT face=3DArial=20
size=3D2>methods to</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>see </FONT><FONT face=3DArial =
size=3D2>how a file is=20
created in the local file system.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Josef</FONT></DIV></BODY></HTML>
------=_NextPart_000_0010_01C2E747.D9D3B5E0--