[Seaside] uploads.. how?

Alain Fischer seaside@lists.squeakfoundation.org
Mon, 30 Sep 2002 17:53:22 +0200


Hi Ragnar,

To use file upload, 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 Lundi 30 septembre 2002, =E0 02:04 , Ragnar Hojland Espinosa a =E9crit =
:

> Another seaside 0.94 day, another question :/
>
> html
>     ^ #(html (form sea:id: add enctype: 'multipart/form-data'
>     	  (input type: file name '@file')
> 	  (input type: submit)
>     ))
>
> but it compains that:
>
>     IAFile(Object)>>doesNotUnderstand:
>
>        self an IAFile
>           aMessage a Message with selector: #isEmpty and arguments: =
#()
>
> I'v read past threads, and I'm under the impression that uploads were
> included in 0.94.. so what am I doing wrong?
> --
> Ragnar Hojland - Project Manager
> Linalco "Especialistas Linux y en Software Libre"
> Tel: +34-91-5970074 Fax: +34-91-5970083
> _______________________________________________
> Seaside mailing list
> Seaside@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>