[Seaside] saving & uploading files?

Alain Fischer seaside@lists.squeakfoundation.org
Wed, 28 Aug 2002 22:20:34 +0200


Hi Tim,

I have used file upload with version 0.93 of Seaside. I don't know if=20
this
is still valid. Julian please correct me if I am wrong.
I hope I will soon be able to try version 0.94 or version 2 when it will=20=

be
officialy released.

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 Mercredi 28 ao=FBt 2002, =E0 06:51 , Tim Rowledge a =E9crit :

> Julian Fitzell <julian@beta4.com> is claimed by the authorities to =
have=20
> written:
>
>
>> Not sure I ever tried using it myself but I think that was how it was
>> supposed to work.  Have you had specific problems with it or just
>> wondering where to start?
> The latter; I've no idea what one does to provide for an upload
> field/form/entry/whatever it is.
>
> And let's not forget the download stuff; the only approach I can think
> of at the moment is to save the info to a file and just return it from
> a new URL. That simply has to be wrong - its so ugly.
>
> tim
> --
> Tim Rowledge, tim@sumeru.stanford.edu, http://sumeru.stanford.edu/tim
> Klingon Code Warrior:- 6) "Our competitors are without honor!"
>
> _______________________________________________
> Seaside mailing list
> Seaside@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>