plugins.file.showFileOpenDialog

Hello everybody.

I tried out the file-plugin above. I searched the forum on that topic, but I still can´t get this working.

I´m getting an error with =“TypeError: Cannot read property “length””
What am I doing wrong or is something missing?

function onActionDir(event) {

/** @type {plugins.file.JSFile[]} */
datei = plugins.file.showFileOpenDialog(null,null,false,new Array("JPG", "jpg"),upload(),'Datei auswählen');

function upload(){
	for (var i = 0; i < datei.length; i++) {
	application.output('Datei: ' + datei[i].getName());

Thanks in advance for your Help.

Regards,
Christof

Hi,

Try this,

function onAction(event) {
	
	/** @type {plugins.file.JSFile[]} */
	var datei = plugins.file.showFileOpenDialog(null,null,false,new Array("JPG", "jpg"),upload,'Datei auswählen');
}

then created a separate function,

function upload(datei){
	   for (var i = 0; i < datei.length; i++) {
	     application.output('Datei: ' + datei[i].getName());
	   }
}

Regards,

Peter

Hello Peter,

that worked.

Thanks a lot.

Regards,

Christof