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