On Fri, Mar 11, 2011 at 2:12 AM, Stanislav Feldman
<stanisla...@gmail.com> wrote:
> How can I upload file via CB?
--
Evan Miller
http://www.evanmiller.org/
--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
152 'POST' ->
153 Record = lists:foldr(fun
154 ('id', Acc) -> Acc:set(id, 'id');
155 (Attr, Acc) ->
156 AttrName = atom_to_list(Attr),
157 Val = Req:post_param(AttrName),
158 [{_, FileName, Location, Length}] = Req:post_files(),
159 Val1 = case erlang:length(FileName) > 0 of
160 true ->
161 Fname = "./priv/static/" ++ FileName,
162 file:copy(Location, Fname),
163 file:delete(Location),
164 Fname;
165 _ -> Req:post_param(AttrName)
166 end,
167 Acc:set(Attr, Val1)
168 end, DummyRecord, DummyRecord:attribute_names()),