[Seaside] multipart form data
Alain Fischer
alain.fischer@bluewin.ch
Thu, 23 May 2002 01:50:40 +0200
Hi Rob,
Avi just sended me an early implementation for file upload.
The upload of file is now integrated in Seaside (I checked with a fresh=20=
0.93).
To use it, you need to make a component:
IAComponent subclass: #AFiUploadFilePage
instanceVariableNames: 'uploadFile '
classVariableNames: ''
poolDictionaries: ''
category: ''
html
^ '<form action=3D"@upload" enctype=3D"multipart/form-data">
<input type=3D"file" name=3D"@uploadFile" size=3D"80"><br>=
<input type=3D"submit" value=3D"Send file">
</form>'
upload
"Here do what you want with:
uploadFile fileName
uploadFile contents"
The bad things is that the fileName returned is fully dependant of the=20=
browser
and the plateform used: different kind of path separators, sometime full=20=
path,
sometime only the filename. Ahhhhh the joy of web development ;-)
To get a correct fileName, I used the following (the most current path=20=
separators):
(uploadFile fileName findTokens: '/\:') last
which should work on more current cases.
Have a nice day.
Alain
Le Mercredi 22 mai 2002, =E0 03:09 , Rob Whitfield a =E9crit :
> Does anyone know how to upload a file within the seaside environment? =20=
> Specifically, on a form submission, how do I get the file to actually=20=
> be saved by the server (i.e. comanche)?
>
> Hi Alain,
>
> I saw the thread you started on file upload via seaside. I can't seem=20=
> to find a way to unencode Avi's mime encoded cs files. Could you=20
> forward the cs files to me or tell me how to unencode the mime encoded=20=
> information that Avi posted?
>
> Regards,
> Rob