Hi John,<br><br>Thanks for this information. My head is spinning right now ;-) but I will look into it, and probably ask more questions if I understand this better.<br><br>Van.<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Date: Wed, 24 Mar 2010 11:27:07 -0700<br>
From: John M McIntosh <<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>><br>
Subject: Re: [Seaside] What alternative for fileUpload with WAFile for<br>
large files?<br>
To: Seaside - general discussion <<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>><br>
Message-ID:<br>
<<a href="mailto:DEF8230A-9B70-4B4C-BEFC-E0D28BA0F6F9@smalltalkconsulting.com">DEF8230A-9B70-4B4C-BEFC-E0D28BA0F6F9@smalltalkconsulting.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Ah, it shouldn't run out of memory.<br>
<br>
Wikiserver for the iPhone uses an older version of Pier and I and to make a few changes (which were fed back to the Pier folks) to ensure<br>
it could stream up/down 50MB files on a device within a 10 MB free memory footprint.<br>
<br>
However the support isn't quite turned on or accessible by default.<br>
You have to do<br>
<br>
WAKomEncoded default streamUploads: true.<br>
<br>
which then alters a decision to use<br>
<br>
WATemporaryFile<br>
versus<br>
WAFile<br>
<br>
The original email for this is below, but the implementation that was done by the Pier team is different.<br>
<br>
Ok in order to get streaming to work, so that I could upload and see a 58MB TIFF image on a remote browser from the iphone wikiserver but use no more than 30MB of memory I had do the following:<br>
Well turn it on: WAKom default streamUploads: true.<br>
<br>
<br>
MAFileUploadComponet>>upload: aFile<br>
<br>
"First this did contents: aFile contents which won't work with 800MB files,<br>
"Alter to execute a method that takes the aFile"<br>
<br>
self value: (aFile isNil ifFalse: [<br>
self description kind new<br>
mimetype: aFile contentType;<br>
filename: aFile fileName;<br>
contentsFromWATemporaryFilePRoxy: aFile;<br>
yourself ])<br>
<br>
<br>
The helper methods then do contentsFromWATemporaryFilePRoxy<br>
<br>
MAExternalFileModel>>contentsFromWATemporaryFilePRoxy: file<br>
| writeStream readStream |<br>
<br>
writeStream := self writeStream.<br>
readStream := file stream.<br>
filesize := readStream size.<br>
[FileDirectory default copyFile: readStream toFile: writeStream] ensure:<br>
[readStream close.<br>
writeStream close]<br>
<br>
MAFileModel>>contentsFromWATemporaryFilePRoxy: file<br>
self contents: file contents<br>
<br>
<br>
The next issue was the data coming back and in urlOn: it would super to MAFileModel which would do<br>
urlOn: html<br>
^ html context<br>
urlForDocument: self contents<br>
mimeType: self mimetype<br>
fileName: self filename<br>
<br>
"Again self contents"<br>
<br>
I altered the subclass then to do:<br>
<br>
MAExternalFileModel>>urlOn: html<br>
<br>
^ self baseUrl isNil<br>
ifTrue: [html context<br>
urlForDocument: self<br>
mimeType: self mimetype<br>
fileName: self filename]<br>
ifFalse: [ self baseUrl , '/' , (self location reduce: [ :a :b | a , '/' , b ]) , '/' , self filename ]<br>
<br>
Lastly we need to keep the logic from creating a mime document and caching the contents, rather<br>
we need to create a localfilemimedocment by doing<br>
<br>
MAExernalFileModel>>asMIMEDocumentType: mimeType<br>
^self readStream asMIMEDocumentType: mimeType<br></blockquote></div><br><div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}</style>