Skip to content

Commit a9f9fa2

Browse files
committed
chore: example updated
1 parent 5b94bed commit a9f9fa2

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

samples/Node.js/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This sample is written for [Node.js 0.6+](http://nodejs.org/) and requires [Expr
55
To install and run:
66

77
cd samples/Node.js
8-
npm install express
8+
npm install express@3.*
99
node app.js
1010

1111
Then browse to [localhost:3000](http://localhost:3000).

samples/Node.js/public/index.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h3>Demo</h3>
2626
</div>
2727

2828
<div class="flow-drop" ondragenter="jQuery(this).addClass('flow-dragover');" ondragend="jQuery(this).removeClass('flow-dragover');" ondrop="jQuery(this).removeClass('flow-dragover');">
29-
Drop files here to upload or <a class="flow-browse-folder"><u>select folder</u></a> or <a class="flow-browse"><u>select from your computer</u></a>
29+
Drop files here to upload or <a class="flow-browse-folder"><u>select folder</u></a> or <a class="flow-browse"><u>select from your computer</u></a> or <a class="flow-browse-image"><u>select images</u></a>
3030
</div>
3131

3232
<div class="flow-progress">
@@ -62,6 +62,7 @@ <h3>Demo</h3>
6262
r.assignDrop($('.flow-drop')[0]);
6363
r.assignBrowse($('.flow-browse')[0]);
6464
r.assignBrowse($('.flow-browse-folder')[0], true);
65+
r.assignBrowse($('.flow-browse-image')[0], false, false, {accept: 'image/*'});
6566

6667
// Handle file add event
6768
r.on('fileAdded', function(file){
@@ -72,7 +73,10 @@ <h3>Demo</h3>
7273
'<li class="flow-file flow-file-'+file.uniqueIdentifier+'">' +
7374
'Uploading <span class="flow-file-name"></span> ' +
7475
'<span class="flow-file-size"></span> ' +
75-
'<span class="flow-file-progress"></span>' +
76+
'<span class="flow-file-progress"></span> ' +
77+
'<a href="" class="flow-file-download" target="_blank">' +
78+
'Download' +
79+
'</a> ' +
7680
'<span class="flow-file-pause">' +
7781
' <img src="pause.png" title="Pause upload" />' +
7882
'</span>' +
@@ -86,6 +90,7 @@ <h3>Demo</h3>
8690
var $self = $('.flow-file-'+file.uniqueIdentifier);
8791
$self.find('.flow-file-name').text(file.name);
8892
$self.find('.flow-file-size').text(readablizeBytes(file.size));
93+
$self.find('.flow-file-download').attr('href', '/download/' + file.uniqueIdentifier).hide();
8994
$self.find('.flow-file-pause').on('click', function () {
9095
file.pause();
9196
$self.find('.flow-file-pause').hide();
@@ -109,12 +114,11 @@ <h3>Demo</h3>
109114
$('.flow-progress .progress-resume-link, .flow-progress .progress-pause-link').hide();
110115
});
111116
r.on('fileSuccess', function(file,message){
117+
var $self = $('.flow-file-'+file.uniqueIdentifier);
112118
// Reflect that the file upload has completed
113-
$('.flow-file-'+file.uniqueIdentifier+' .flow-file-progress')
114-
.text('(completed)');
115-
$('.flow-file-'+file.uniqueIdentifier+'')
116-
.find('.flow-file-pause, .flow-file-resume')
117-
.remove();
119+
$self.find('.flow-file-progress').text('(completed)');
120+
$self.find('.flow-file-pause, .flow-file-resume').remove();
121+
$self.find('.flow-file-download').attr('href', '/download/' + file.uniqueIdentifier).show();
118122
});
119123
r.on('fileError', function(file, message){
120124
// Reflect that the file upload has resulted in error

0 commit comments

Comments
 (0)