comparison tests/blob.ur @ 737:d049d31a1966

Initial support for blobs and upload
author Adam Chlipala <adamc@hcoop.net>
date Sat, 25 Apr 2009 13:59:11 -0400
parents
children 4bb7e1c0550a
comparison
equal deleted inserted replaced
736:796e42c93c48 737:d049d31a1966
1 sequence s
2 table t : { Id : int, Nam : option string, Data : blob, Desc : string }
3
4 fun save r =
5 if numFiles r.Data <> 1 then
6 error <xml>Please submit exactly one file.</xml>
7 else
8 let
9 val f = fileNum r.Data 0
10 in
11 id <- nextval s;
12 dml (INSERT INTO t (Id, Nam, Data, Desc) VALUES ({[id]}, {[fileName f]}, {[fileData f]}, {[r.Desc]}));
13 main ()
14 end
15
16 and main () = return <xml><body>
17 <form>
18 <textbox{#Desc}/>
19 <upload{#Data}/>
20 <submit action={save}/>
21 </form>
22 </body></xml>