Skip to content

Instantly share code, notes, and snippets.

@dredozubov
Created June 15, 2018 16:16
Show Gist options
  • Save dredozubov/a11f84bff87ca1335d57b3bfc60f0ddd to your computer and use it in GitHub Desktop.
Save dredozubov/a11f84bff87ca1335d57b3bfc60f0ddd to your computer and use it in GitHub Desktop.
fun echo r =
if blobSize (fileData r.File) > 100000 then
return <xml>Whoa! That one's too big.</xml>
else
returnBlob (fileData r.File) (blessMime (fileMimeType r.File))
fun main () = return <xml><body>
<h1>The Amazing File Echoer!</h1>
<form>Upload a file: <upload{#File}/> <submit action={echo}/></form>
</body></xml>
allow mime text/plain
allow mime image/png
allow mime image/gif
upload
val main : unit -> transaction page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment