add imagebin so i can work on it from another computer
parent
7dabe9b1f6
commit
cc4f60b029
|
@ -0,0 +1 @@
|
|||
Doug Coleman
|
|
@ -0,0 +1,38 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel furnace.actions html.forms
|
||||
http.server.dispatchers db db.tuples db.types urls
|
||||
furnace.redirection multiline http namespaces ;
|
||||
IN: webapps.imagebin
|
||||
|
||||
TUPLE: imagebin < dispatcher ;
|
||||
|
||||
TUPLE: image id path ;
|
||||
|
||||
image "IMAGE" {
|
||||
{ "id" "ID" INTEGER +db-assigned-id+ }
|
||||
{ "path" "PATH" { VARCHAR 256 } +not-null+ }
|
||||
} define-persistent
|
||||
|
||||
: <uploaded-image-action> ( -- action )
|
||||
<page-action>
|
||||
{ imagebin "uploaded-image" } >>template ;
|
||||
|
||||
SYMBOL: my-post-data
|
||||
: <upload-image-action> ( -- action )
|
||||
<page-action>
|
||||
{ imagebin "upload-image" } >>template
|
||||
[
|
||||
request get post-data>> my-post-data set-global
|
||||
! image new
|
||||
! "file" value
|
||||
! insert-tuple
|
||||
! "uploaded-image" <redirect>
|
||||
] >>submit ;
|
||||
|
||||
: <imagebin> ( -- responder )
|
||||
imagebin new-dispatcher
|
||||
<upload-image-action> "" add-responder
|
||||
<upload-image-action> "upload-image" add-responder
|
||||
<uploaded-image-action> "uploaded-image" add-responder ;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version='1.0' ?>
|
||||
<html>
|
||||
<head><title>Upload</title></head>
|
||||
<body>
|
||||
<form action="upload-image" method="post" enctype="multipart/form-data" name="upload">
|
||||
|
||||
<table>
|
||||
<tr><th class="field-label">Image: </th><td><input type="file" name="file1" /></td></tr>
|
||||
<tr><th class="field-label">Image: </th><td><input type="file" name="file2" /></td></tr>
|
||||
<tr><th class="field-label">Image: </th><td><input type="file" name="file3" /></td></tr>
|
||||
<tr><th class="field-label">Text: </th><td><input type="text" name="text1" /></td></tr>
|
||||
</table>
|
||||
|
||||
<p> <button type="submit">Submit</button> </p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' ?>
|
||||
<html>
|
||||
<head><title>Uploaded</title></head>
|
||||
<body>
|
||||
hi from uploaded-image
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue