From 94d3081ae946b97194cfb58a9d43421a4f5e25b0 Mon Sep 17 00:00:00 2001
From: Andi Neck
Date: Mon, 4 Feb 2013 17:13:21 +0100
Subject: [PATCH 01/44] json format has changed...
see:
https://groups.google.com/forum/#!searchin/jquery-fileupload/empty/jquer
y-fileupload/0q8PN2v0I28/pOYs76W-VsEJ
and: https://github.com/blueimp/jQuery-File-Upload/wiki/Setup
format:
{"files": [
{
"name": "picture1.jpg",
"size": 902604,
"url": "http:\/\/example.org\/files\/picture1.jpg",
"thumbnail_url":
"http:\/\/example.org\/files\/thumbnail\/picture1.jpg",
"delete_url": "http:\/\/example.org\/files\/picture1.jpg",
"delete_type": "DELETE"
},
{
"name": "picture2.jpg",
"size": 841946,
"url": "http:\/\/example.org\/files\/picture2.jpg",
"thumbnail_url":
"http:\/\/example.org\/files\/thumbnail\/picture2.jpg",
"delete_url": "http:\/\/example.org\/files\/picture2.jpg",
"delete_type": "DELETE"
}
]}
---
lib/filehandler.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/filehandler.js b/lib/filehandler.js
index 6870b5d..70dec2f 100644
--- a/lib/filehandler.js
+++ b/lib/filehandler.js
@@ -8,14 +8,16 @@ module.exports = function (middleware, options) {
var UploadHandler = require('./uploadhandler')(options);
var handler = new UploadHandler(req, res, function (result, redirect) {
if (redirect) {
- res.redirect(redirect.replace(/%s/, encodeURIComponent(JSON.stringify(result))));
+ files = {files: result};
+ res.redirect(redirect.replace(/%s/, encodeURIComponent(JSON.stringify(files))));
} else {
res.set({
'Content-Type': (req.headers.accept || '').indexOf('application/json') !== -1
? 'application/json'
: 'text/plain'
});
- res.json(200, result);
+ files = {files: result};
+ res.json(200, files);
}
});
From d4061ac6623e5ddbe73ac450672da12e02c36cf2 Mon Sep 17 00:00:00 2001
From: Olivier Lalonde
Date: Mon, 6 May 2013 23:50:51 +0800
Subject: [PATCH 02/44] Fixed JSON output format to be compatible with
jquery-file-upload
https://github.com/blueimp/jQuery-File-Upload/wiki/JSON-Response
---
lib/filehandler.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/filehandler.js b/lib/filehandler.js
index 70dec2f..ce5a578 100644
--- a/lib/filehandler.js
+++ b/lib/filehandler.js
@@ -17,7 +17,7 @@ module.exports = function (middleware, options) {
: 'text/plain'
});
files = {files: result};
- res.json(200, files);
+ res.json(200, { files: files });
}
});
From d618e00940b63c55b78f167859315c9eac4a738e Mon Sep 17 00:00:00 2001
From: soomtong-onweekendpc
Date: Fri, 6 Sep 2013 17:09:05 +0900
Subject: [PATCH 03/44] `update` 0.0.9
---
.gitignore | 26 +++++++++++++++++++-
History.md | 5 ++++
README.md | 33 ++++++++++++++++++++++++++
examples/.bowerrc | 4 ++++
examples/README.md | 5 ++++
examples/app.js | 23 +++++++++---------
examples/bower.json | 13 ++++++++++
examples/config.js | 2 +-
examples/package.json | 6 ++---
examples/public/scripts/file_upload.js | 10 ++++----
examples/tmp/readme.md | 1 +
examples/views/form.html | 28 ++++++++++++----------
index.js | 2 +-
lib/fileinfo.js | 4 ++--
lib/filemanager.js | 2 +-
lib/uploadhandler.js | 1 -
16 files changed, 125 insertions(+), 40 deletions(-)
create mode 100644 examples/.bowerrc
create mode 100644 examples/bower.json
create mode 100644 examples/tmp/readme.md
diff --git a/.gitignore b/.gitignore
index 40b878d..0ca9404 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,25 @@
-node_modules/
\ No newline at end of file
+### intellij ###
+*.iml
+*.ipr
+*.iws
+.idea/
+
+### node ###
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules
+
+### example ###
+public/lib/
\ No newline at end of file
diff --git a/History.md b/History.md
index b47f606..9dcf043 100644
--- a/History.md
+++ b/History.md
@@ -1,3 +1,8 @@
+0.0.9 / 2013-09-06
+==================
+
+ * update today's jquery-file-upload
+
0.0.8 / 2013-01-01
==================
diff --git a/README.md b/README.md
index 0aaac0a..7110a2d 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,39 @@
jquery-file-upload-middleware
=============================
+### Personal Patch Repository
+
+Please comeback [Aleksandr Guidrevitch](http://aguidrevitch.blogspot.com/) lol
+
+- use bower to install jquery-file-upload (planed)
+- use not npm to install jquery-file-upload-middleware
+- use this repository by
+
+```json
+{
+ "name": "your project",
+ "version": "0.1.0",
+ "private": true,
+ "dependencies": {
+ "express": "3.3.x",
+ "jquery-file-upload-middleware": "git://github.com/soomtong/jquery-file-upload-middleware.git",
+ "swig": "1.0.x",
+ "imagemagick": "0.1.x"
+ },
+ "devDependencies": {
+ "nodeunit":"*"
+ }
+}
+```
+
+
+
+
+
+---
+
+## Readme will update later
+
jQuery-File-Upload Express.js middleware. Based on the server code of [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload)
Installation:
diff --git a/examples/.bowerrc b/examples/.bowerrc
new file mode 100644
index 0000000..0f29f6a
--- /dev/null
+++ b/examples/.bowerrc
@@ -0,0 +1,4 @@
+{
+ "directory": "public/lib",
+ "json": "bower.json"
+}
\ No newline at end of file
diff --git a/examples/README.md b/examples/README.md
index 3f8c0d8..32c2010 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1,9 +1,14 @@
## YET ANOTHER JQUERY FILE UPLOAD MIDDLEWARE EXAMPLES
+- use bower to install jquery-file-upload script (tested version 8.8.5)
+
to run
```
+project > npm insatll
+project > cd examples
project/examples > npm insatll
+project/examples > bower insatll
project/examples > node app.js
```
diff --git a/examples/app.js b/examples/app.js
index 4667fcd..429526d 100644
--- a/examples/app.js
+++ b/examples/app.js
@@ -8,11 +8,9 @@
* */
var express = require('express'),
http = require('http'),
- //upload = require('../index');
- upload = require('jquery-file-upload-middleware'); // don't work 0.0.8 && update > 0.0.8
+ upload = require('../');
-var cons = require('consolidate'),
- swig = require('swig');
+var swig = require('swig');
// configuration
@@ -26,15 +24,12 @@ var app = express();
// set template engine
-app.engine('html', cons.swig);
-swig.init({
- root: __dirname + '/views',
- allowErrors: true,
- cache: false
+app.engine('html', swig.renderFile);
+swig.setDefaults({
+ cache: false // default 'memory'
});
-
// jquery-file-upload helper
app.use('/upload/default', function (req, res, next) {
upload.fileHandler({
@@ -74,6 +69,7 @@ upload.on('end', function (fileInfo) {
upload.on('delete', function (fileName) {
// remove file info
+ console.log("files remove complete");
console.log(fileName);
});
@@ -114,7 +110,11 @@ app.configure('production', function () {
* routes
* */
app.get('/', function (req, res) {
- res.send('Call this url in browser : http://localhost:3001/location/input');
+ var html = [
+ 'Call this url in browser : http://localhost:3001/location/input Go
',
+ 'Call this url in browser : http://localhost:3001/upload/location/list Go
'
+ ].join('');
+ res.send(html);
});
@@ -140,4 +140,5 @@ app.post('/location/input', function (req, res) {
http.createServer(app).listen(app.get('port'), function () {
console.log("Express server listening on port " + app.get('port'));
console.log("access url /location/input");
+ console.log("access url /upload/location/list");
});
diff --git a/examples/bower.json b/examples/bower.json
new file mode 100644
index 0000000..1c7639f
--- /dev/null
+++ b/examples/bower.json
@@ -0,0 +1,13 @@
+{
+ "name": "jquery-file-upload-middleware",
+ "version": "0.0.1",
+ "ignore": [
+ ".jshintrc",
+ "**/*.txt"
+ ],
+ "dependencies": {
+ "jquery-file-upload": "8.8.5"
+ },
+ "devDependencies": {
+ }
+}
\ No newline at end of file
diff --git a/examples/config.js b/examples/config.js
index 129c04e..b4138cc 100644
--- a/examples/config.js
+++ b/examples/config.js
@@ -46,7 +46,7 @@ exports.resizeVersion = {
};
exports.directors = {
- temp: './public/tmp',
+ temp: './tmp',
default: '/public/uploads/default',
default_url: '/uploads/default',
diff --git a/examples/package.json b/examples/package.json
index d65805b..c435dee 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -2,9 +2,7 @@
"name":"examples",
"version":"0.0.1",
"dependencies":{
- "express":">= 3.0.0",
- "consolidate":">= 0.4.0",
- "swig":">= 0.12.0",
- "jquery-file-upload-middleware": "> 0.0.8"
+ "express":"3.3.x",
+ "swig":"1.0.x"
}
}
\ No newline at end of file
diff --git a/examples/public/scripts/file_upload.js b/examples/public/scripts/file_upload.js
index ea8d49d..603c48f 100644
--- a/examples/public/scripts/file_upload.js
+++ b/examples/public/scripts/file_upload.js
@@ -66,13 +66,13 @@ $('#location_gallery').fileupload({
row.find('.name a').text(file.name);
if (file.url) {
row.find('.preview').append('
')
- .find('img').prop('src', file.small_url);
+ .find('img').prop('src', file.smallUrl);
row.find('a').prop('rel', 'gallery');
}
row.find('a').prop('href', file.url);
- row.find('.delete button')
+ row.find('.delete')
.attr('data-type', file.delete_type)
- .attr('data-url', file.delete_url);
+ .attr('data-url', file.deleteUrl);
// add file data input
row.append('')
.find('input[name="galleryImage[]"]').val(file.name);
@@ -151,13 +151,13 @@ $('#location_cover').fileupload({
row.find('.name a').text(file.name);
if (file.url) {
row.find('.preview').append('
')
- .find('img').prop('src', file.medium_url);
+ .find('img').prop('src', file.mediumUrl);
row.find('a').prop('rel', 'gallery');
}
row.find('a').prop('href', file.url);
row.find('.delete button')
.attr('data-type', file.delete_type)
- .attr('data-url', file.delete_url);
+ .attr('data-url', file.deleteUrl);
// add file data input
row.append('')
.find('input[name="excerptImage"]').val(file.name);
diff --git a/examples/tmp/readme.md b/examples/tmp/readme.md
new file mode 100644
index 0000000..f63726f
--- /dev/null
+++ b/examples/tmp/readme.md
@@ -0,0 +1 @@
+temp folder
\ No newline at end of file
diff --git a/examples/views/form.html b/examples/views/form.html
index 4a6b78d..728da47 100644
--- a/examples/views/form.html
+++ b/examples/views/form.html
@@ -1,8 +1,8 @@
{{title}}
+
-
@@ -54,8 +54,8 @@
-
-
+
+
@@ -65,16 +65,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+