Skip to content

file is not removed if upload is canceled #259

@thewilli

Description

@thewilli

Consider this minimal working example (Multer v1.1.0 on Windows 7, OS X 10.11 and Ubuntu 14.04 with node v4.2.1):

var express = require('express')
var multer  = require('multer')
var upload = multer({ dest: 'uploads/' })
var app = express();

app.post("/upload", upload.single("file"), function(req, res, next){
    res.end("uploaded to: " + req.file.filename);
});
app.listen(80);

and the following test script

# create large test file
$ dd if=/dev/urandom bs=2G count=1 of=upload
# upload
$ curl -F "file=@upload" http://localhost/upload
# upload again, but cancel before upload is finished
timeout -s SIGKILL 2s curl -F "file=@upload" http://localhost/upload

Expected behavior:
Only the first file is persisted, the second is removed after the upload got canceled.

Actual behaviour:
Both files are stored in the uploads folder

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions