landline/examples/form2/index.rhtml

36 lines
1.2 KiB
Plaintext

<!DOCTYPE>
<html>
<head>
<title>Form upload test</title>
<style>
.form { display: flex; flex-direction: column }
</style>
</head>
<body>
<h1>Form upload test</h1>
<hr/>
<p> Please enter the following details: <p>
<form method="post"
class="form"
enctype="multipart/form-data">
<input type="text" name="form_name" placeholder="Name" required>
<input type="text" name="form_company" placeholder="Company" required>
<input type="text" name="form_phone" placeholder="Phone" required>
<textarea name="comment" placeholder="Comment"></textarea>
<input id="form_files" type="file" name="form_files[]" multiple>
<label for="form_files">Attach file</label>
<input type="submit" value="Send form">
</form>
<% if (defined? formdata) and formdata %>
<hr>
<ul>
<% formdata.each do |key, part| %>
<li><%= key %>: <%= escape_html(part.is_a?(String) ? part : "File: #{part.map do |x| x.filename end.join(',')}") %></li>
<% end %>
</ul>
<% end %>
</body>
</html>