Uncaught InvalidStateError:

I’ve been struggling with an exceptionally gnarly bug and cannot for the life of me figure out what’s going wrong. Hopefully someone from this forum can help me.

When trying to upload a file within a form (using ember-cli-form-data) the following exception is generated:

“Uncaught InvalidStateError: Failed to set the ‘value’ property on ‘HTMLInputElement’: This input element accepts a filename, which may only be programmatically set to the empty string.” ember.debug.js:2685

Looking at the source in ember.debug.js I find:

 prototype.setPropertyStrict = function (element, name, value) {
// element = input#file-field.form-control.ember-view.ember-text-field, name = "value", value = File {}
    if (value === undefined) {
      value = null;
    }

    if (value === null && (name === 'value' || name === 'type' || name === 'src')) {
      // value = File {}, name = "value"
      value = '';
    }

    element[name] = value; // (x) Kaboom!!
  };

Where (x) Kaboom!! marks the spot where the exception occurs, and the values shown within the debug are placed in comments on the relevant lines.

Anyone happen to know what’s going wrong?