I’m using wp media to upload image using Javascript.
JS Part is here –
handleLogoUpload () {
var self = this;
// If the media frame already exists, reopen it.
if ( this.wpmedia ) {
this.wpmedia.open();
return;
}
// Create a new media frame
this.wpmedia = wp.media({
title: __( 'Select or Upload Media Of Your Chosen Persuasion' ),
button: {
text: __( 'Use this media' )
},
type : 'image',
multiple: false
});
this.wpmedia.on( 'select', function() {
// Handle this in my way
});
this.wpmedia.open();
},
I’ve also enqueued the Media library in PHP end.
But when, I just choose an image from Local directory to Upload Getting this error –
Uncaught TypeError: this.options is undefined
createAttachmentView http://wpex.test/wp-includes/js/media-views.js?ver=5.9.2:9336
It seems error in media-views.js
.
Is there anyone have faced this before.