[Seaside] Uploading large files

Colin Putney cputney at wiresong.ca
Sun Aug 19 04:12:22 UTC 2007


On Aug 15, 2007, at 2:16 PM, cnantais wrote:

> So, I changed it to this:
>
> WATempFile>>initializeFromChunk: aChunk
> 	fileName _ aChunk fileName.
> 	contentType _ aChunk contentType.
> 	(self tempDirectory
> 		forceNewFileNamed: self tempFileName)
> 		do: [:f | fileSize _ aChunk saveToStream: f]
>
> And it now works, almost.  I'm seeing no increase in memory  
> consumption when
> I submit an upload of a 10mb mp3 file. Only problem is that it is  
> creating
> zero-byte files in the 'tmp' directory when I upload something,  
> like so:

Oops. #forceNewFileNamed:do: is peculiar to my image - that  
definitely won't work in a stock image. I'm surprised that what  
you've got there doesn't throw an error. It should be something like  
this:

WATempFile>>initializeFromChunk: aChunk
	fileName _ aChunk fileName.
	contentType _ aChunk contentType.
	f := self tempDirectory forceNewFileNamed: self tempFileName.
	[fileSize := aChunk saveToStream: f]
		ensure: [f close]

Colin


More information about the seaside mailing list