Permalink
Browse files

Adding field_name to #uploaded_file record

  • Loading branch information...
1 parent 6a25d40 commit 1c79cb1d1bd17b766229b793ea8fd511ecb8de4f @ngaranko ngaranko committed with Mar 20, 2013
Showing with 6 additions and 5 deletions.
  1. +1 −1 include/simple_bridge.hrl
  2. +5 −4 src/simple_bridge_multipart.erl
@@ -6,7 +6,7 @@
-record(cookie, { name, value, path="/", minutes_to_live=20 }).
-record(header, { name, value }).
-record(response, { statuscode=200, headers=[], cookies=[], data=[] }).
--record(uploaded_file, { original_name, temp_file, size }).
+-record(uploaded_file, { original_name, temp_file, size, field_name }).
-record(request_cache, {request, docroot="", body=""}).
-compile({parse_transform,pmod_pt}).
@@ -80,11 +80,12 @@ parse_multipart(Req) ->
{
ok,
[{Name, Value} || #part { name=Name, value=Value, filename=undefined } <- State1#state.parts],
- [#uploaded_file {
+ [#uploaded_file {
original_name=Filename,
- temp_file=TempFile,
- size=Size
- } || #part { filename=Filename, value={file, TempFile}, size=Size } <- State1#state.parts]
+ temp_file=TempFile,
+ size=Size,
+ field_name=Name
+ } || #part { filename=Filename, value={file, TempFile}, size=Size, name=Name } <- State1#state.parts]
}
catch
throw : post_too_big -> {error, post_too_big};

0 comments on commit 1c79cb1

Please sign in to comment.