upr.git  about / heads / tags
Upload Progress for Rack
blob f5ecb5b9d9d7c5def15555dd869c7d690a8e0c35 2065 bytes (raw)
$ git show HEAD:examples/rails_app-2.3.4/app/views/files/new.html.erb	# shows this blob on the CLI

 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
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- example taken from git://github.com/drogus/jquery-upload-progress -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>ajaxFileUpload</title>
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<script src="/javascripts/jquery.js"></script>
		<script src="/javascripts/jquery.uploadProgress.js"></script>
		<script type="text/javascript">
			$(function() {
				$('form').uploadProgress({
					/* scripts locations for safari */
					jqueryPath: "/javascripts/jquery.js",
					uploadProgressPath: "/javascripts/jquery.uploadProgress.js",
					start:function(){},
					uploading: function(upload) {$('#percents').html(upload.percents+'%');},
					interval: 500
			    });
			});
		</script>
		<style type="text/css">
			.bar {
			  width: 300px;
			}

			#progress {
			  background: #eee;
			  border: 1px solid #222;
			  margin-top: 20px;
			}
			#progressbar {
			  width: 0px;
			  height: 24px;
			  background: #333;
			}
		</style>
	</head>

	<body>
    <% if flash[:notice] %>
    <h1><%= flash[:notice] %></h1>
    <% end %>
<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
  <a href="http://github.com/drogus/jquery-upload-progress"
  >jQuery-upload-progress</a>
</p>
<p>
  Also, see the <a href="/">mongrel_upload_progress-compatible</a> version
</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>

	  <form id="upload" enctype="multipart/form-data" action="/files/new" method="post">
        <input name="data" type="file"/>
        <input type="submit" value="Upload"/>
      </form>

	    <div id="uploading">
	      <div id="progress" class="bar">
	        <div id="progressbar">&nbsp;</div>
	      </div>
	    </div>
		<div id="percents"></div>
	</body>
</html>

git clone https://yhbt.net/upr.git