[Zope] How to get the path?

Dylan Reinhardt zope@dylanreinhardt.com
Sun, 09 Mar 2003 23:46:04 -0800


At 11:30 PM 3/9/2003, Sorin Marti wrote:
>Hi all,
>
>I want to upload files to the filesystem on my server (not into zope's 
>Data.fs)
>
>With <input type="file" name="file"> I get the filename...right?
>
>But If I want to copy it with an external method like this:
>
>copy = os.system('cp %s /tmp' %file.filename)
>
>it doesent work because file.filename is only the file but not the path... 
>(for example test.pdf)
>
>How do I get the path?

If you're asking how to get the path where the client stored the file 
they're uploading, you can't.  That information is not provided by any 
browser I'm aware of... it's considered private and/or sensitive.

If you're looking for a way to specify a path where an uploaded file should 
be stored on the server's filesystem, you could allow the client to specify 
it with a text box or select control.  But if you're really looking to 
upload a bunch of files to a remote filesystem, there are far better ways 
to do this, like ftp and scp.

If you're looking for how to upload files to Zope, take a look at the HTML 
source behind the Add File interface... it should tell you most of what you 
need to know.

HTH,

Dylan