1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
| | <html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>upr test, http://upr.bogomips.org/</title>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'upr' %>
<style type="text/css">
#progress-bar {
width:500px;
height:25px;
margin:15px;
border:solid 1px #000;
position:relative;
}
#progress-bar #status-bar {
display:block;
height:25px;
width:0;
background-color:#00f;
border-right:solid 1px #000;
position:absolute;
top:0; left:0;
}
#progress-bar #status-text {
display:block;
padding: 0 15px;
line-height:25px;
position:absolute;
top:0; left:0;
}
</style>
</head>
<body>
<%
upid = "#{Time.now.to_i}.#{rand}"
act = { :action => 'upload', :upload_id => upid }
opt = {
:multipart => true,
:target => 'upload',
:onsubmit => "UploadProgress.monitor('#{escape_javascript(upid)}')"
}
-%>
<p>
This is a demo of <a href="http://upr.bogomips.org/">upr</a> in action.
Much of this (including all JS) was stolen from the mongrel_upload_progress
examples.
</p>
<p>
Also, see the <a href="/files/new">jQuery-compatible interface</a>
that's also compatible with upload progress modules for nginx and lighttpd.
</p>
<p>
Last but not least, check out the <a href="/files/pull">Ajax.Pull</a>
example that uses a single, streaming HTTP response to interatively
send progress updates.
</p>
<p><%= link_to upid, :action => 'status', :upload_id => upid %></p>
<% form_tag(act, opt) do %>
<div id="file-fields">
<p><%= file_field_tag :data %></p>
</div>
<p><%= link_to_function 'Add File Field', 'UploadProgress.FileField.add()' %>
</p>
<p><%= submit_tag :Upload %></p>
<% end %>
<div id="results"></div>
<div id="progress-bar"></div>
<p>The size and SHA1 of the file you uploaded should appear here</p>
<iframe id="upload" name="upload" src="about:blank"></iframe>
</body>
</html>
|