currently uploaded files are handled like 'normal' fields and their
value is read via the MultipartPostParameter's getString(). the result
is that the properties get the string content of the uploaded files. i
think this is not what people want.
i suggest to implement a default behaviour that creates an 'nt:file'
subnode for that uploaded file if the field name has a trailing slash
(and if the request parameter is a file upload), eg:
<form action="/home/tripod/profile" method="post" enctype="multipart/form-data">
<input type="file" name="./portrait/" />
</form>
results in:
+ home
+ tripod
+ portrait [nt:file]
+ jcr:content [nt:resource]
- jcr:data (data of uploaded file)
without the trailing slash in the values name, it would just create a
binary property.
there might also be the need to store the file directly in a 'nt:resource':
<form action="/home/tripod/profile" method="post" enctype="...">
<input type="file" name="./portrait/" />
<input type="hidden" name="./portrait/@TypeHint" value="nt:resource" />
</form>
but this is all a bit magic. we can also go the straight forward way
and address the correct properties:
<form action="/home/tripod/profile" method="post" enctype="...">
<input type="hidden" name="./portrait/jcr:primaryType" value="nt:file" />
<input type="hidden" name="./portrait/jcr:content/jcr:primaryType"
value="nt:resource" />
<input type="file" name="./portrait/jcr:content/jcr:data" />
</form>
there would still be some magic in order to set the jcr:mimeType and
the jcr:lastModified.
WDYT ?
regards, toby
--
-----------------------------------------< [EMAIL PROTECTED] >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---