summaryrefslogtreecommitdiff
path: root/tests/blob.ur
blob: a62eefc1e7aabbcb3e9b1f48b4674ddb9c0cbf1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
sequence s
table t : { Id : int, Nam : option string, Data : blob, Desc : string }

fun save r =
    if numFiles r.Data <> 1 then
        error <xml>Please submit exactly one file.</xml>
    else
        let
            val f = fileNum r.Data 0
        in
            id <- nextval s;
            dml (INSERT INTO t (Id, Nam, Data, Desc) VALUES ({[id]}, {[fileName f]}, {[fileData f]}, {[r.Desc]}));
            main ()
        end

and main () = return <xml><body>
  <form>
    <textbox{#Desc}/>
    <upload{#Data}/>
    <submit action={save}/>
  </form>
</body></xml>