Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restrict file types #335

Closed
johncarmichael opened this issue May 29, 2015 · 3 comments
Closed

restrict file types #335

johncarmichael opened this issue May 29, 2015 · 3 comments

Comments

@johncarmichael
Copy link

From the docs and the code i cannot see a way of restricting the incoming file types.

I only want to allow a select list, is this possible?

These are the only options i could see to set with formidable:

function IncomingForm(opts) {
  if (!(this instanceof IncomingForm)) return new IncomingForm(opts);
  EventEmitter.call(this);

  opts=opts||{};

  this.error = null;
  this.ended = false;

  this.maxFields = opts.maxFields || 1000;
  this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
  this.keepExtensions = opts.keepExtensions || false;
  this.uploadDir = opts.uploadDir || os.tmpDir();
  this.encoding = opts.encoding || 'utf-8';
  this.headers = null;
  this.type = null;
  this.hash = opts.hash || false;
  this.multiples = opts.multiples || false;

  this.bytesReceived = null;
  this.bytesExpected = null;

  this._parser = null;
  this._flushing = 0;
  this._fieldsSize = 0;
  this.openedFiles = [];

  return this;
}
@caomanhquang
Copy link

Why no one answer this?

@xarguments
Copy link
Collaborator

Duplicate of #387
Answer is there.

@tunnckoCore
Copy link
Member

tunnckoCore commented Jun 24, 2018

And probably use the .on('fileBegin', handler) API.

https://github.com/felixge/node-formidable#filebegin

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

No branches or pull requests

4 participants