Last active
June 23, 2016 08:44
-
-
Save johansolve/250aa1c87919f367d45d31ffb2d7d39a to your computer and use it in GitHub Desktop.
This method overrides file_uploads to return an array of maps for compatibility with Lasso 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/* | |
The built-in file_uploads of Lasso9 returns a staticarray och staticarray pairs, | |
instead of the array of maps in Lasso8. | |
This method overrides file_uploads to return an array of maps. It also adds a few missing members from Lasso8. | |
*/ | |
define file_uploads => { | |
local(result=array) | |
with upload in web_request->fileUploads do { | |
local(upload_map=map) | |
with uploadfield in #upload do { | |
#upload_map->insert(#uploadfield->name = #uploadfield->value) | |
} | |
#upload_map | |
->insert('path'=#upload_map->find('tmpfilename')) | |
& insert('file'=file(#upload_map->find('tmpfilename'))) | |
& insert('size'=#upload_map->find('filesize')) | |
& insert('type'=#upload_map->find('contenttype')) | |
& insert('param'=#upload_map->find('fieldname')) | |
& insert('origname'=#upload_map->find('filename')) | |
& insert('origpath'=#upload_map->find('filename')) | |
& insert('origextension'=#upload_map->find('filename')->ascopy->split('.')->last) | |
#result->insert(#upload_map) | |
} | |
return #result | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment