HTMLViewer and <input type="file">

Hi

I have a web application that uses html elements to upload files. The html looks like this:

<input name="ImageFile" class="form-control" id="ImageFile" type="file" accept="image/*" value="" capture="camera"> 

If a user (I have tested this) presses this button that this html generates using:

Chrome, Internet Explorer, FireFox and Safari (across Windows, iOS, Android, OS X, Linux (Ubuntu) where applicable) they are presented with a dialog that prompts for a file to upload. iOS even helpfully offers the live camera and the photo libraries as sources. Safari on OS X uses a sheet window file dialog and Windows + Linux use modal file dialogs.

I have created a simple desktop application just like the demo Web Browser from the Quick Start docs, using HTMLViewer and these input elements work correctly on Windows & Linux but on OS X nothing happens, no event is fired and no dialog is displayed.

So my problem seems to be that <input type=file …> when used inside HTMLViewer does not work as expected only on a OS X desktop application but works as expected on Windows and Linux. Have I overlooked or misunderstood something?

Confirmed. And it does not fire newWindow either.

You could use Window.Status = in your page to send back to your app, catch that in StatusChange, show a GetOpenFolderItem dialog then put the value back in the HTML page TextField with JavaScript.

on OS X you need to implement WebUIDelegate and implement the event runOpenPanelForFileButtonWithResultListener in our MBS Plugin:

see
http://monkeybreadsoftware.net/class-webuidelegatembs.shtml

I coded that 9 years ago :slight_smile:

[quote=249724:@Michel Bujardet]Confirmed. And it does not fire newWindow either.

You could use Window.Status = in your page to send back to your app, catch that in StatusChange, show a GetOpenFolderItem dialog then put the value back in the HTML page TextField with JavaScript.[/quote]

Thanks Michel, the NewWindow event is a little annoying as well, if only it passed the Url that was being requested as a parameter I could use it for quite a few things such as this and invoking dialogs in the container application but as it stands I will have to watch for a StatusChange Url followed by a NewWindow which seems a bit hack-like.

Darn - this is the one time that when I needed it - the MacOS implementation is the one that fails, it is usually the poor Windows and Linux cousins who get left out or are buggy :frowning:

[quote=249725:@Christian Schmitz]on OS X you need to implement WebUIDelegate and implement the event runOpenPanelForFileButtonWithResultListener in our MBS Plugin:
[/quote]

I may take a look at that, thanks. What would I need to buy to get that working?

[quote=249724:@Michel Bujardet]Confirmed. And it does not fire newWindow either.

You could use Window.Status = in your page to send back to your app, catch that in StatusChange, show a GetOpenFolderItem dialog then put the value back in the HTML page TextField with JavaScript.[/quote]
Actually you can’t. Selecting files is one of those things that requires the response to happen in the same event loop as the user’s mouse click event.

you need our Cocoa plugins probably.

Please file a bug report.

Bug report 42744 has been filed