Skip to content

Commit d618e00

Browse files
committed
update 0.0.9
1 parent f55ade8 commit d618e00

16 files changed

+125
-40
lines changed

.gitignore

+25-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
node_modules/
1+
### intellij ###
2+
*.iml
3+
*.ipr
4+
*.iws
5+
.idea/
6+
7+
### node ###
8+
lib-cov
9+
*.seed
10+
*.log
11+
*.csv
12+
*.dat
13+
*.out
14+
*.pid
15+
*.gz
16+
17+
pids
18+
logs
19+
results
20+
21+
npm-debug.log
22+
node_modules
23+
24+
### example ###
25+
public/lib/

History.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.0.9 / 2013-09-06
2+
==================
3+
4+
* update today's jquery-file-upload
5+
16
0.0.8 / 2013-01-01
27
==================
38

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
jquery-file-upload-middleware
22
=============================
33

4+
### Personal Patch Repository
5+
6+
Please comeback [Aleksandr Guidrevitch](http://aguidrevitch.blogspot.com/) lol
7+
8+
- use bower to install jquery-file-upload (planed)
9+
- use not npm to install jquery-file-upload-middleware
10+
- use this repository by
11+
12+
```json
13+
{
14+
"name": "your project",
15+
"version": "0.1.0",
16+
"private": true,
17+
"dependencies": {
18+
"express": "3.3.x",
19+
"jquery-file-upload-middleware": "git://github.com/soomtong/jquery-file-upload-middleware.git",
20+
"swig": "1.0.x",
21+
"imagemagick": "0.1.x"
22+
},
23+
"devDependencies": {
24+
"nodeunit":"*"
25+
}
26+
}
27+
```
28+
29+
30+
31+
32+
33+
---
34+
35+
## Readme will update later
36+
437
jQuery-File-Upload Express.js middleware. Based on the server code of [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload)
538

639
Installation:

examples/.bowerrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"directory": "public/lib",
3+
"json": "bower.json"
4+
}

examples/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
## YET ANOTHER JQUERY FILE UPLOAD MIDDLEWARE EXAMPLES
22

3+
- use bower to install jquery-file-upload script (tested version 8.8.5)
4+
35
to run
46

57
```
8+
project > npm insatll
9+
project > cd examples
610
project/examples > npm insatll
11+
project/examples > bower insatll
712
project/examples > node app.js
813
```
914

examples/app.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
* */
99
var express = require('express'),
1010
http = require('http'),
11-
//upload = require('../index');
12-
upload = require('jquery-file-upload-middleware'); // don't work 0.0.8 && update > 0.0.8
11+
upload = require('../');
1312

14-
var cons = require('consolidate'),
15-
swig = require('swig');
13+
var swig = require('swig');
1614

1715

1816
// configuration
@@ -26,15 +24,12 @@ var app = express();
2624

2725

2826
// set template engine
29-
app.engine('html', cons.swig);
30-
swig.init({
31-
root: __dirname + '/views',
32-
allowErrors: true,
33-
cache: false
27+
app.engine('html', swig.renderFile);
28+
swig.setDefaults({
29+
cache: false // default 'memory'
3430
});
3531

3632

37-
3833
// jquery-file-upload helper
3934
app.use('/upload/default', function (req, res, next) {
4035
upload.fileHandler({
@@ -74,6 +69,7 @@ upload.on('end', function (fileInfo) {
7469

7570
upload.on('delete', function (fileName) {
7671
// remove file info
72+
console.log("files remove complete");
7773
console.log(fileName);
7874
});
7975

@@ -114,7 +110,11 @@ app.configure('production', function () {
114110
* routes
115111
* */
116112
app.get('/', function (req, res) {
117-
res.send('Call this url in browser : http://localhost:3001/location/input');
113+
var html = [
114+
'<p>Call this url in browser : http://localhost:3001/location/input <a href="/location/input">Go</a></p>',
115+
'<p>Call this url in browser : http://localhost:3001/upload/location/list <a href="/upload/location/list">Go</a></p>'
116+
].join('');
117+
res.send(html);
118118
});
119119

120120

@@ -140,4 +140,5 @@ app.post('/location/input', function (req, res) {
140140
http.createServer(app).listen(app.get('port'), function () {
141141
console.log("Express server listening on port " + app.get('port'));
142142
console.log("access url /location/input");
143+
console.log("access url /upload/location/list");
143144
});

examples/bower.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "jquery-file-upload-middleware",
3+
"version": "0.0.1",
4+
"ignore": [
5+
".jshintrc",
6+
"**/*.txt"
7+
],
8+
"dependencies": {
9+
"jquery-file-upload": "8.8.5"
10+
},
11+
"devDependencies": {
12+
}
13+
}

examples/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ exports.resizeVersion = {
4646
};
4747

4848
exports.directors = {
49-
temp: './public/tmp',
49+
temp: './tmp',
5050

5151
default: '/public/uploads/default',
5252
default_url: '/uploads/default',

examples/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"name":"examples",
33
"version":"0.0.1",
44
"dependencies":{
5-
"express":">= 3.0.0",
6-
"consolidate":">= 0.4.0",
7-
"swig":">= 0.12.0",
8-
"jquery-file-upload-middleware": "> 0.0.8"
5+
"express":"3.3.x",
6+
"swig":"1.0.x"
97
}
108
}

examples/public/scripts/file_upload.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ $('#location_gallery').fileupload({
6666
row.find('.name a').text(file.name);
6767
if (file.url) {
6868
row.find('.preview').append('<a><img></a>')
69-
.find('img').prop('src', file.small_url);
69+
.find('img').prop('src', file.smallUrl);
7070
row.find('a').prop('rel', 'gallery');
7171
}
7272
row.find('a').prop('href', file.url);
73-
row.find('.delete button')
73+
row.find('.delete')
7474
.attr('data-type', file.delete_type)
75-
.attr('data-url', file.delete_url);
75+
.attr('data-url', file.deleteUrl);
7676
// add file data input
7777
row.append('<input type="hidden" name="galleryImage[]">')
7878
.find('input[name="galleryImage[]"]').val(file.name);
@@ -151,13 +151,13 @@ $('#location_cover').fileupload({
151151
row.find('.name a').text(file.name);
152152
if (file.url) {
153153
row.find('.preview').append('<a><img></a>')
154-
.find('img').prop('src', file.medium_url);
154+
.find('img').prop('src', file.mediumUrl);
155155
row.find('a').prop('rel', 'gallery');
156156
}
157157
row.find('a').prop('href', file.url);
158158
row.find('.delete button')
159159
.attr('data-type', file.delete_type)
160-
.attr('data-url', file.delete_url);
160+
.attr('data-url', file.deleteUrl);
161161
// add file data input
162162
row.append('<input type="hidden" name="excerptImage">')
163163
.find('input[name="excerptImage"]').val(file.name);

examples/tmp/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
temp folder

examples/views/form.html

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!DOCTYPE html>
22
<head>
33
<title>{{title}}</title>
4+
<link rel="stylesheet" type="text/css" href="/lib/jquery-file-upload/css/jquery.fileupload-ui.css">
45
<link rel="stylesheet" type="text/css" href="/styles/style.css" />
5-
<link rel="stylesheet" type="text/css" href="http://blueimp.github.com/jQuery-File-Upload/css/jquery.fileupload-ui.css">
66
</head>
77
<body>
88
<div id="contain">
@@ -54,8 +54,8 @@
5454
</fieldset>
5555

5656
<div class="bg-location-submit">
57-
<button class="bg-button" type="submit">전송</button>
58-
<button class="bg-button" type="reset">취소</button>
57+
<button class="bg-button" type="submit">Submit</button>
58+
<button class="bg-button" type="reset">Cancel</button>
5959
</div>
6060

6161
</form>
@@ -65,16 +65,18 @@
6565
</div>
6666

6767
</div>
68-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
69-
<script src="http://blueimp.github.com/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
70-
71-
<script src="http://blueimp.github.com/JavaScript-Load-Image/load-image.min.js"></script>
72-
<script src="http://blueimp.github.com/JavaScript-Canvas-to-Blob/canvas-to-blob.min.js"></script>
73-
74-
<script src="http://blueimp.github.com/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
75-
<script src="http://blueimp.github.com/jQuery-File-Upload/js/jquery.fileupload.js"></script>
76-
<script src="http://blueimp.github.com/jQuery-File-Upload/js/jquery.fileupload-fp.js"></script>
77-
<script src="http://blueimp.github.com/jQuery-File-Upload/js/jquery.fileupload-ui.js"></script>
68+
<script src="/lib/jquery/jquery.min.js"></script>
69+
<script src="/lib/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
70+
<script src="/lib/blueimp-load-image/js/load-image.min.js"></script>
71+
<script src="/lib/blueimp-canvas-to-blob/js/canvas-to-blob.min.js"></script>
72+
<script src="/lib/jquery-file-upload/js/jquery.iframe-transport.js"></script>
73+
<script src="/lib/jquery-file-upload/js/jquery.fileupload.js"></script>
74+
<script src="/lib/jquery-file-upload/js/jquery.fileupload-ui.js"></script>
75+
<script src="/lib/jquery-file-upload/js/jquery.fileupload-process.js"></script>
76+
<script src="/lib/jquery-file-upload/js/jquery.fileupload-image.js"></script>
77+
<script src="/lib/jquery-file-upload/js/jquery.fileupload-audio.js"></script>
78+
<script src="/lib/jquery-file-upload/js/jquery.fileupload-video.js"></script>
79+
<script src="/lib/jquery-file-upload/js/jquery.fileupload-validate.js"></script>
7880
<script type="text/javascript" src="/scripts/file_upload.js"></script>
7981
</body>
8082
</html>

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ JqueryFileUploadMiddleware.prototype.fileManager = function (options) {
5454
return require('./lib/filemanager')(this, this.prepareOptions(_.extend(this.options, options)));
5555
};
5656

57-
module.exports = new JqueryFileUploadMiddleware();
57+
module.exports = new JqueryFileUploadMiddleware();

lib/fileinfo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = function (options) {
88
this.originalName = file.name;
99
this.size = file.size;
1010
this.type = file.type;
11-
this.delete_type = 'DELETE';
11+
this.deleteType = 'DELETE';
1212
};
1313

1414
FileInfo.prototype.validate = function () {
@@ -34,7 +34,7 @@ module.exports = function (options) {
3434
};
3535

3636
FileInfo.prototype.setUrl = function (type, baseUrl) {
37-
var key = type ? type + '_url' : 'url';
37+
var key = type ? type + 'Url' : 'url';
3838
this[key] = baseUrl + '/' + encodeURIComponent(this.name);
3939
}
4040

lib/filemanager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ module.exports = function (middleware, options) {
158158
if (exists) {
159159
move(options.uploadDir() + '/' + version + '/' + filename, targetDir + '/' + version + '/', function (err, safename) {
160160
if (!err && relative)
161-
urls[version + '_url'] = targetUrl + '/' + version + '/' + safename;
161+
urls[version + 'Url'] = targetUrl + '/' + version + '/' + safename;
162162
finish(err);
163163
});
164164
}

lib/uploadhandler.js

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ module.exports = function (options) {
5151
};
5252

5353
UploadHandler.prototype.post = function () {
54-
5554
var self = this,
5655
form = new formidable.IncomingForm(),
5756
tmpFiles = [],

0 commit comments

Comments
 (0)