Skip to content

Commit 26205b5

Browse files
committed
update
1 parent b0c2c63 commit 26205b5

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

examples/public/scripts/file_upload.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
var requestDomain = 'http://172.17.0.138:3001';
1+
// var requestUrl = 'http://172.17.0.138:3001' + '/upload/location';
2+
var requestUrl = 'http://arch.upload.aaa.cn/m/21/upload?cmd=arch-upload-test';
23
var redirectUrl = location.protocol + '//' + location.host + '/cors/result.html?%s';
3-
var forceIframeTransport = true;
4+
var forceIframeTransport = false;
45

56
$('#location_gallery').fileupload({
67
forceIframeTransport: forceIframeTransport,
78
redirect: redirectUrl,
89
dataType:'json',
9-
url: requestDomain + '/upload/location',
10+
url: requestUrl,
1011
autoUpload: true,
1112
sequentialUploads:true,
1213
acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i,
@@ -92,7 +93,7 @@ $('#location_gallery').fileupload({
9293

9394
$('#location_cover').fileupload({
9495
dataType:'json',
95-
url: requestDomain + '/upload/location',
96+
url: requestUrl,
9697
autoUpload: true,
9798
acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i,
9899
process:[

lib/filehandler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ module.exports = function (middleware, options) {
3636
middleware.emit('delete', fileName, req, res);
3737
});
3838

39-
switch (req.method) {
39+
// _method for xdr-transport
40+
var method = req.param('_method') || req.method;
41+
42+
switch (method) {
4043
case 'OPTIONS':
4144
res.end();
4245
break;

lib/uploadhandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ module.exports = function (options) {
179179

180180
UploadHandler.prototype.destroy = function () {
181181
var self = this,
182-
fileName = path.basename(decodeURIComponent(this.req.url));
182+
fileName = path.basename(decodeURIComponent(this.req.path));
183183

184184
var filepath = path.join(options.uploadDir(), fileName);
185185
if (filepath.indexOf(options.uploadDir()) !== 0) {

0 commit comments

Comments
 (0)