view tests/blob.ur @ 740:b302b6e35f93

Add MIME type to file
author Adam Chlipala <adamc@hcoop.net>
date Sat, 25 Apr 2009 14:47:16 -0400
parents 4bb7e1c0550a
children 43553c93dd8c
line wrap: on
line source
sequence s
table t : { Id : int, Nam : option string, Data : blob, Desc : string, Typ : string }

fun save r =
    id <- nextval s;
    dml (INSERT INTO t (Id, Nam, Data, Desc, Typ)
         VALUES ({[id]}, {[fileName r.Data]}, {[fileData r.Data]}, {[r.Desc]}, {[fileMimeType r.Data]}));
    main ()

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