Reputation: 7252
i have to set default image path into formbuilder but given exception. i have also try with empty string and null.
buildForm() {
this.userForm = this.formBuilder.group({
location_id: this.formBuilder.control(null),
image: this.formBuilder.control('assets/images-demo/avatars/user.png'),
});
}
ERROR DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.
Upvotes: 4
Views: 2917
Reputation: 29775
Error says that it is not possible to set input programmatically for type='file'
.
Only empty string is possible.
Many posts say that this is a security issue to change the input value for file
type.
jQuery, Select Input FILE and also set it to another INPUT
Upvotes: 3