htdocs/upload.lua
author Timm S. Mueller <tmueller@neoscientists.org>
Sun, 29 Apr 2007 14:29:44 +0200
changeset 184 d6dab49fa14a
parent 0 d4b36cfa50e8
child 194 e12e08560301
permissions -rw-r--r--
Internal links are now always treated lowercase
     1 <%
     2 
     3 local tek = require "tek"
     4 
     5 if loona.args.file and loona.args.show then
     6 	
     7 	local f = loona.args.file.file:read("*a")
     8 	loona:setheader("Content-Type: " .. loona.args.file["content-type"] .. "\n\n")
     9 	loona:out(f)
    10 
    11 else
    12 	
    13 	loona:setheader("Content-Type: text/html; charset=utf-8\n\n")
    14 %>
    15 	<?xml version="1.0"?>
    16 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    17 	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    18 		<head>
    19 			<title>
    20 				Upload Test
    21 			</title>
    22 		</head>
    23 		<body>
    24 			<form action="<%=loona.document%>" method="post" enctype="multipart/form-data">	
    25 				<fieldset>
    26 					<legend>
    27 						Please upload picture
    28 					</legend>
    29 					<input type="hidden" name="processupload" value="true" />
    30 					<br />
    31 					<input name="file" type="file" size="50" maxlength="100000" accept="image/*" />
    32 					<br />
    33 					Show picture in browser: <input type="checkbox" name="show" />
    34 					<br />
    35 					<input type="submit" />
    36 				</fieldset>
    37 			</form>
    38 			<hr />
    39 <pre>
    40 <%tek.dump(tek.cgi.request, tek.web.out)%>
    41 </pre>
    42 			<hr />
    43 <pre>
    44 <%tek.dump(tek.cgi.document, tek.web.out)%>
    45 </pre>
    46 		</body>
    47 	</html>
    48 
    49 <%end%>