Skip to content

Use original filename in node sample post callback.#46

Merged
AidasK merged 1 commit intoflowjs:masterfrom
Partyschaum:use-original-filename-in-flow-node
Sep 9, 2014
Merged

Use original filename in node sample post callback.#46
AidasK merged 1 commit intoflowjs:masterfrom
Partyschaum:use-original-filename-in-flow-node

Conversation

@Partyschaum
Copy link
Copy Markdown
Contributor

This change enables saving the uploaded file with correct filename using the write method of flow.write.

flow.post(req, function(status, filename, originalFilename, identifier) {
  if (status === 'done') {
    var stream = fs.createWriteStream(__dirname + '/../images/' + originalFilename);
    flow.write(identifier, stream);
    stream.on('finish', function() {
      console.log('Finished writing ' + originalFilename);
    });
  }
});

AidasK added a commit that referenced this pull request Sep 9, 2014
…-node

fix: use original filename in node sample post callback.
@AidasK AidasK merged commit 7ac9f22 into flowjs:master Sep 9, 2014
@AidasK
Copy link
Copy Markdown
Member

AidasK commented Sep 9, 2014

Merged, but I think, you also need to escape originalFilename before saving it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants