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?
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
Dylan Reinhardt wrote:
At 11:30 PM 3/9/2003, Sorin Marti wrote:
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
My problem is following: In our intranet it should be possible to upload TeX-Sources. These Sources I want to compile into a pdf and a html version and then I want to store them in different folders. So: I don't want to upload a file to zope because (I hope I'm right) then it is stored as a zope object in the zope-filesystem (or how that is called..) and I can't manipulate the file then... right? So what I want to do is: upload ONE file into servers filesystem and I haven't found a good homepage explaining how to solve that problem... BTW: I knoe that there is stuff like DTML-TeX and the possibility to create pdf on the fly, but I want to try it by myself... Thanks for any advices, links and hints... -mas PS: I am working under linux.
At 11:56 PM 3/9/2003, Sorin Marti wrote:
In our intranet it should be possible to upload TeX-Sources. These Sources I want to compile into a pdf and a html version and then I want to store them in different folders.
OK
So: I don't want to upload a file to zope because (I hope I'm right) then it is stored as a zope object in the zope-filesystem
Yes... in the Zope Object Database (ZODB).
and I can't manipulate the file then... right?
Well... you can manipulate the object and you can set up methods to the object that return files.
So what I want to do is: upload ONE file into servers filesystem and I haven't found a good homepage explaining how to solve that problem...
I think you're looking for LocalFS: http://sourceforge.net/projects/localfs HTH, Dylan
Sorin Marti wrote at 2003-3-10 08:30 +0100:
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?
First of all, you get the file as a "ZPublisher.HTTPRequest.FileUpload" instance. Such an instance behaves like a file (you have the typical Python file operations: "read", "seek", "tell", ...). In addition, they have additional attributes which inform about the HTTP context: "filename" (the name of the file uploaded) and "headers" (maybe similar -- view the source!) with the MIME headers associated with this file. Dieter
participants (3)
-
Dieter Maurer -
Dylan Reinhardt -
Sorin Marti