1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel furnace.actions html.forms
4 http.server.dispatchers db db.tuples db.types urls
5 furnace.redirection multiline http namespaces ;
8 TUPLE: imagebin < dispatcher ;
10 TUPLE: image id path ;
13 { "id" "ID" INTEGER +db-assigned-id+ }
14 { "path" "PATH" { VARCHAR 256 } +not-null+ }
17 : <uploaded-image-action> ( -- action )
19 { imagebin "uploaded-image" } >>template ;
22 : <upload-image-action> ( -- action )
24 { imagebin "upload-image" } >>template
27 ! request get post-data>> my-post-data set-global
31 "uploaded-image" <redirect>
34 : <imagebin> ( -- responder )
35 imagebin new-dispatcher
36 <upload-image-action> "" add-responder
37 <upload-image-action> "upload-image" add-responder
38 <uploaded-image-action> "uploaded-image" add-responder ;