Debian Codegraph @

demo/src/main/webapp/index.html

raw
1 <!doctype html>
2 <html>
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 <meta name="viewport" content="width=device-width">
6 <link type="text/css" rel="stylesheet" href="common.css">
7 <title>Angular file upload sample</title>
8
9 <script type="text/javascript">
10 FileAPI = {
11 debug: true,
12 //forceLoad: true, html5: false //to debug flash in HTML5 browsers
13 //wrapInsideDiv: true, //experimental for fixing css issues
14 //only one of jsPath or jsUrl.
15 //jsPath: '/js/FileAPI.min.js/folder/',
16 //jsUrl: 'yourcdn.com/js/FileAPI.min.js',
17
18 //only one of staticPath or flashUrl.
19 //staticPath: '/flash/FileAPI.flash.swf/folder/'
20 //flashUrl: 'yourcdn.com/js/FileAPI.flash.swf'
21 };
22 </script>
23
24 <!-- <script src="//code.jquery.com/jquery-1.9.0.min.js"></script> -->
25 <script type="text/javascript">
26 // load angularjs specific version
27 var angularVersion = window.location.hash.substring(1);
28 if (angularVersion.indexOf('/') == 0) angularVersion = angularVersion.substring(1);
29 document.write('<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/' +
30 (angularVersion || '1.2.24') + '/angular.js"><\/script>');
31 </script>
32 <script src="js/ng-file-upload-shim.js"></script>
33 <script src="js/ng-file-upload.js"></script>
34 <script src="js/upload.js"></script>
35
36 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.8.0/codemirror.min.css">
37 <script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.8.0/codemirror.min.js"></script>
38 <script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.8.0/mode/htmlmixed/htmlmixed.min.js"></script>
39 <script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.8.0/mode/htmlembedded/htmlembedded.min.js"></script>
40 <script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.8.0/mode/xml/xml.min.js"></script>
41 <script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.8.0/mode/javascript/javascript.min.js"></script>
42 </head>
43
44 <body ng-app="fileUpload" ng-controller="MyCtrl">
45 <div class="ng-v">
46 Angular Version: <input type="text" ng-model="angularVersion">
47 <input type="button" data-ng-click="changeAngularVersion()" value="Go">
48 </div>
49 <h2>Angular file upload Demo</h2>
50
51 <h3>
52 Visit <a href="https://github.com/danialfarid/ng-file-upload">ng-file-upload</a> on github
53 </h3>
54
55 <div class="upload-div">
56 <div class="edit-div">
57 <a ng-click="showEdit = !showEdit" href="javascript:void(0)">+ edit upload html</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
58 <a ng-show="showEdit" ng-click="confirm() && (editHtml = defaultHtml)" href="javascript:void(0)">reset to
59 default</a><br/><br/>
60
61 <div ng-show="showEdit" id="htmlEdit"></div>
62 </div>
63
64 <div class="upload-buttons">
65 <div id="editArea">
66 <div>
67 <div>
68 <form name="myForm">
69 <fieldset>
70 <legend>Upload on form submit</legend>
71 Username: <input type="text" name="userName" ng-model="username" size="39" required>
72 <i ng-show="myForm.userName.$error.required">*required</i><br>
73 Profile Picture: <input type="file" ngf-select ng-model="picFile" name="file" ngf-accept="'image/*'" required>
74 <i ng-show="myForm.file.$error.required">*required</i>
75 <br/>
76
77 <button ng-disabled="!myForm.$valid" ng-click="uploadPic(picFile)">Submit</button>
78 <img ngf-src="picFile" class="thumb">
79 <span class="progress" ng-show="picFile.progress >= 0">
80 <div style="width:{{picFile.progress}}%" ng-bind="picFile.progress + '%'"></div>
81 </span>
82 <span ng-show="picFile.result">Upload Successful</span>
83 </fieldset>
84 <br/>
85 </form>
86 </div>
87 <fieldset>
88 <legend>Play with options</legend>
89 <div class="up-buttons">
90 <div ngf-select ngf-drop ng-model="files" ngf-model-invalid="invalidFiles"
91 ngf-model-options="modelOptionsObj"
92 ngf-multiple="multiple" ngf-pattern="pattern" ngf-accept="acceptSelect"
93 ng-disabled="disabled" ngf-capture="capture"
94 ngf-drag-over-class="dragOverClassObj"
95 ngf-validate="validateObj"
96 ngf-resize="resizeObj"
97 ngf-resize-if="resizeIfFn($file, $width, $height)"
98 ngf-dimensions="dimensionsFn($file, $width, $height)"
99 ngf-duration="durationFn($file, $duration)"
100 ngf-keep="keepDistinct ? 'distinct' : keep"
101 ngf-fix-orientation="orientation"
102 ngf-max-files="maxFiles"
103 ngf-ignore-invalid="ignoreInvalid"
104 ngf-run-all-validations="runAllValidations"
105 ngf-allow-dir="allowDir" class="drop-box" ngf-drop-available="dropAvailable">Select File
106 <span ng-show="dropAvailable"> or Drop File</span>
107 </div>
108 <br/>
109 <div ngf-drop ng-model="files" ngf-model-invalid="invalidFiles"
110 ngf-model-options="modelOptionsObj"
111 ngf-multiple="multiple" ngf-pattern="'image/*'"
112 ng-disabled="disabled"
113 ngf-drag-over-class="dragOverClassObj"
114 ngf-validate="validateObj"
115 ngf-resize="resizeObj"
116 ngf-resize-if="resizeIfFn($file, $width, $height)"
117 ngf-dimensions="dimensionsFn($file, $width, $height)"
118 ngf-duration="durationFn($file, $duration)"
119 ngf-keep="keepDistinct ? 'distinct' : keep"
120 ngf-enable-firefox-paste="true"
121 ngf-fix-orientation="orientation"
122 ngf-max-files="maxFiles"
123 ngf-ignore-invalid="ignoreInvalid"
124 ngf-run-all-validations="runAllValidations"
125 ngf-allow-dir="allowDir" class="drop-box" ng-show="dropAvailable">
126 <span>Paste or Drop Image from browser</span></div>
127 </div>
128 <div class="custom">
129 <label>accept (for select browser dependent): <input type="text" ng-model="acceptSelect"></label><br/>
130 <label>ngf-capture (for mobile): <input type="text" ng-model="capture"></label><br/>
131 <label>ngf-pattern (validate file model): <input type="text" ng-model="pattern"></label><br/>
132 <label>ngf-validate: <input type="text" ng-model="validate" size="49"></label><br/>
133 <label>ngf-drag-over-class (chrome): <input size="31" type="text" ng-model="dragOverClass"></label><br/>
134 <label>ngf-model-options: <input type="text" size="43" ng-model="modelOptions"></label><br/>
135 <label>ngf-resize: <input type="text" size="43" ng-model="resize"></label><br/>
136 <label>ngf-resize-if: <input type="text" size="43" ng-model="resizeIf"></label><br/>
137 <label>ngf-dimensions: <input type="text" size="43" ng-model="dimensions"></label><br/>
138 <label>ngf-duration: <input type="text" size="43" ng-model="duration"></label><br/>
139 <label>ngf-max-files: <input type="text" size="43" ng-model="maxFiles"></label><br/>
140 <label>ngf-ignore-invalid: <input type="text" size="43" ng-model="ignoreInvalid"></label><br/>
141 <label><input type="checkbox" ng-model="multiple">ngf-multiple (allow multiple files)</label>
142 <label><input type="checkbox" ng-model="disabled">ng-disabled</label><br/>
143 <label><input type="checkbox" ng-model="allowDir">ngf-allow-dir (allow directory drop Chrome
144 only)</label><br/>
145 <label><input type="checkbox" ng-model="keep">ngf-keep (keep the previous model values in
146 ng-model)</label><br/>
147 <label><input type="checkbox" ng-model="keepDistinct">ngf-keep="distinct" (do not allow
148 duplicates)</label><br/>
149 <label><input type="checkbox" ng-model="orientation">ngf-fix-orientation (for exif jpeg files)</label><br/>
150 <label><input type="checkbox" ng-model="runAllValidations">ngf-run-all-validations</label><br/>
151 <label>Upload resumable chunk size: <input type="text" ng-model="chunkSize"></label><br/>
152 </div>
153
154 <div class="preview">
155 <div>Preview image/audio/video:</div>
156 <img ngf-src="!files[0].$error && files[0]">
157 <audio controls ngf-src="!files[0].$error && files[0]"></audio>
158 <video controls ngf-src="!files[0].$error && files[0]"></video>
159 </div>
160 </fieldset>
161 <br/>
162 </div>
163 </div>
164 </div>
165 <ul style="clear:both" class="response">
166 <li class="sel-file" ng-repeat="f in files">
167 <div>
168 <img ngf-thumbnail="!f.$error && f" class="thumb">
169 <span class="progress" ng-show="f.progress >= 0">
170 <div style="width:{{f.progress}}%">{{f.progress}}%</div>
171 </span>
172 <button class="button" ng-click="f.upload.abort();f.upload.aborted=true"
173 ng-show="f.upload != null && f.progress < 100 && !f.upload.aborted">
174 Abort<span ng-show="isResumeSupported">/Pause</span>
175 </button>
176 <button class="button" ng-click="upload(f, true);f.upload.aborted=false"
177 ng-show="isResumeSupported && f.upload != null && f.upload.aborted">Resume
178 </button>
179 <button class="button" ng-click="restart(f);f.upload.aborted=false"
180 ng-show="isResumeSupported && f.upload != null && (f.progress == 100 || f.upload.aborted)">Restart
181 </button>
182 {{f.name}} - size: {{f.size}}B - type: {{f.type}}
183 <a ng-show="f.result" href="javascript:void(0)" ng-click="f.showDetail = !f.showDetail">details</a>
184
185 <div ng-show="f.showDetail">
186 <br/>
187
188 <div data-ng-show="f.result.result == null">{{f.result}}</div>
189 <ul>
190 <li ng-repeat="item in f.result.result">
191 <div data-ng-show="item.name">file name: {{item.name}}</div>
192 <div data-ng-show="item.fieldName">name: {{item.fieldName}}</div>
193 <div data-ng-show="item.size">size on the serve: {{item.size}}</div>
194 <div data-ng-show="item.value">value: {{item.value}}</div>
195 </li>
196 </ul>
197 <div data-ng-show="f.result.requestHeaders" class="reqh">request headers: {{f.result.requestHeaders}}</div>
198 </div>
199 </div>
200 </li>
201 <li class="sel-file" ng-repeat="f in invalidFiles">
202 <div>Invalid File: {{f.$errorMessages}} {{f.$errorParam}}, {{f.name}} - size: {{f.size}}B - type:
203 {{f.type}}
204 </div>
205 </li>
206 </ul>
207
208 <br/>
209
210 <div style="clear:both" class="err" ng-show="errorMsg != null">{{errorMsg}}</div>
211 </div>
212
213 <div style="clear:both" class="server">
214 <div class="srv-title">How to upload to the server:</div>
215
216 <div class="howto">
217 <label><input type="radio" name="howToSend" ng-model="howToSend" value="1" ng-init="howToSend = 1">Upload.upload():
218 multipart/form-data upload cross browser</label>
219 <br/>
220 <label><input type="radio" name="howToSend" ng-model="howToSend" value="2"
221 ng-disabled="usingFlash">Upload.http(): binary content with file's
222 Content-Type</label>
223
224 <div class="sub">Can be used to upload files directory into <a
225 href="https://github.com/danialfarid/angular-file-upload/issues/88">CouchDB</a>,
226 <a href="https://github.com/danialfarid/angular-file-upload/issues/87">imgur</a>, etc... without multipart form
227 data (HTML5 FileReader browsers only)<br/>
228 </div>
229 <label><input type="radio" name="howToSend" ng-model="howToSend" value="3">Amazon S3 bucket upload</label>
230
231 <form ng-show="howToSend==3" class="s3" id="s3form" action="http://localhost:8888" onsubmit="return false">
232 <br/>
233 Provide S3 upload parameters. <a href="http://aws.amazon.com/articles/1434/" target="_blank">Click here for
234 detailed documentation</a><br/></br>
235 <label>S3 upload url including bucket name:</label> <input type="text" ng-model="s3url"> <br/>
236 <label>AWSAccessKeyId:</label> <input type="Text" name="AWSAccessKeyId" ng-model="AWSAccessKeyId"> <br/>
237 <label>acl (private or public):</label> <input type="text" ng-model="acl" value="private"><br/>
238 <label>success_action_redirect:</label> <input type="text" ng-model="success_action_redirect"><br/>
239 <label>policy:</label> <input type="text" ng-model="policy"><br/>
240 <label>signature:</label> <input type="text" ng-model="signature"><br/>
241 <br/>
242 <button ng-click="showHelper=!showHelper">S3 Policy signing helper (Optional)</button>
243 <br/><br/>
244
245 <div class="helper" ng-show="showHelper">
246 If you don't have your policy and signature you can use this tool to generate them by providing these two fields
247 and clicking on sign<br/>
248 <label>AWS Secret Key:</label> <input type="text" ng-model="AWSSecretKey"><br/>
249 <label>JSON policy:</label><br/> <textarea type="text" ng-model="jsonPolicy" rows=10 cols=70></textarea>
250 <button ng-click="generateSignature()">Sign</button>
251 </div>
252 </form>
253 <br/>
254 <br/>
255
256 <div ng-show="howToSend != 3">
257 <input type="checkbox" ng-model="generateErrorOnServer">Return server error with http code: <input type="text"
258 ng-model="serverErrorCode"
259 size="5"> and
260 message: <input type="text" ng-model="serverErrorMsg">
261 <br/>
262 </div>
263 <br/>
264 </div>
265 </div>
266 <a style="position:fixed;bottom:28px;right:10px;font-size:smaller;" target="_blank"
267 href="https://angular-file-upload.appspot.com/donate.html">donate</a>
268 <a style="position:fixed;bottom:45px;right:10px;font-size:smaller;"
269 href="https://github.com/danialfarid/angular-file-upload/issues/new">Feedback/Issues</a>
270 </body>
271 </html>