1. The
filename. There are two filenames, the one of the structure and
the one of the uploaded file. To me it is not clear which one is
preferable to be used? The one of the structure changes when the file
is renamed, the other one is determined by the original filename of
the upload.
the extension is sometimes cruical, since windows uses it to offer a program
that can open it. Can structure names end in .doc?
Yes, that is possible. It is probably more consistent to use the
structure name, because like this one has the possibility to rename.
2. The
serving. There are two ways to serve files. Serving can either
happen using Seaside (the default) or using Apache (which is much more
efficient). The two approaches have completely different semantics, in
the Seaside case we have full control over the path. The approach with
Apache is limited to how Magritte lays out the files to the
file-system, however that could be fixed using X-Sendfile, but then
requires a non-standard plugin in Apache.
it would be ideal if the same image could be used in both scenarios. In one
file would be served from the pier image, for instance when designer is
working on his local copy based on one-click image. In other scenario web
proxy would intercept file requst by recognizing url patttern, and serve the
file it self.
For second scenario to work, there are two important conditions:
- all structures that need to be served as files need to have some
recognizable url like /seaside/pier/content-files/*
- pier should also write uploaded files in equvalent file system directory
structure so nginx or apache could serve it of from there.
This is essentially already implemented, see the class side of
MAExternalFileModel or the PRFileSettings widget to change these
properties from the web. The problem with Apache serving is that the
directories have to be obfuscated to not loose security. This is not a
problem for downloads, but for style-sheets for example that sometimes
use relative references to other files. Using X-Sendfile this could be
fixed relatively easy, but this is a non-standard Apache module.
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch