[squeak-dev] The Trunk: SMLoader-ul.74.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Feb 28 07:08:31 UTC 2011
Levente Uzonyi uploaded a new version of SMLoader to project The Trunk:
http://source.squeak.org/trunk/SMLoader-ul.74.mcz
==================== Summary ====================
Name: SMLoader-ul.74
Author: ul
Time: 28 February 2011, 8:08:20.614 am
UUID: 4d7a5c58-81e1-f54a-8944-abd295b857ab
Ancestors: SMLoader-cmm.73
Don't reference WebUtils directly from SMClient >> #uploadFile:.
=============== Diff against SMLoader-cmm.73 ===============
Item was changed:
----- Method: SMClient>>uploadFile: (in category 'api') -----
uploadFile: aDirectoryEntryFile
"Upload aDirectoryEntryFile to the uploads area of SqueakMap for my userId."
| boundary fieldMap fileStream doc |
fileStream := aDirectoryEntryFile readStream binary.
[ doc := MIMEDocument
contentType: (MIMEDocument guessTypeFromName: aDirectoryEntryFile name)
content: fileStream contents
url: fileStream asUrl ] ensure:
[ fileStream ifNotNil: [ fileStream close ] ].
+ boundary := (Smalltalk at: #WebUtils) multipartBoundary.
- boundary := WebUtils multipartBoundary.
fieldMap := {'upload' -> doc}.
^ (self client
httpPost: self smUrl , '/account/upload'
content:
+ ((Smalltalk at: #WebUtils)
- (WebUtils
encodeMultipartForm: fieldMap
boundary: boundary)
type: MIMEDocument contentTypeMultipart , '; boundary=' , boundary
do: [ : req | req headerAt: 'Connection' put: 'keep-alive' ])
content ;
yourself!
More information about the Squeak-dev
mailing list
|