view src/ur/ajaxUpload.urs @ 0:0c0f903d9440

Submitting to an iframe
author Adam Chlipala <adam@chlipala.net>
date Thu, 29 Dec 2011 14:37:31 -0500
parents
children f84d5e8aa992
line wrap: on
line source
(** A simple widget for uploading files to the server without reloading the current page *)

type handle
(* Unique ID for a file that has been uploaded *)

datatype claim_result =
         NotFound (* That file was either claimed by someone else or was uploaded too long ago and never claimed. *)
       | Found of { Filename : option string,
                    MimeType : string,
                    Content : blob }

val claim : handle -> transaction claim_result
(* In server-side code, claim ownership of a [handle]'s contents, deleting the persistent record of the file data. *)

val render : {} -> transaction xbody
(* Produce HTML for a file upload control *)