Can't upload files in WebBrowser control

65 views
Skip to first unread message

edi.o...@gmail.com

unread,
Feb 3, 2017, 11:35:17 AM2/3/17
to CodenameOne Discussions

Hi,

I am developing application and I am using a WebBrowser control in a page to display some web content.

The  issue is, nothing is happening when we tap on file browse control (inside web browser) .

sample url= http://image.online-convert.com/convert-to-bmp

It seems like there is a limitation to access file system from web browser control.


Is there any workarround to implement file upload functionality in web browser control?



IDE: NetBeans
Desktop OS Linux
Mobile Android

Shai Almog

unread,
Feb 4, 2017, 1:28:51 AM2/4/17
to CodenameOne Discussions
Hi,
file picker is generally problematic in all native OS's and some versions of Android just don't allow it at all within embedded apps. The crux of the issue is elevated permission issues that can be caused by such functionality.

The workaround used by most users is to do the upload from the Codename One code using tools such as MultipartRequest.

Edi Ortega

unread,
Feb 6, 2017, 8:18:41 AM2/6/17
to CodenameOne Discussions
Hi Shai.
I forget to say, work in simulator, but not in cell phone.

I think in the way.
Make a listener in the WebBrowser component to prevent tap of user in button page. Is possible?

About the MultipartRequest, how to i use this class with WebBrowser?

Shai Almog

unread,
Feb 7, 2017, 3:44:00 AM2/7/17
to CodenameOne Discussions
Hi,
the browser in the simulator is radically different from the one on the device.

You can bind a listener in the JavaScript of the page and then use Java code to implement that. See this: https://www.codenameone.com/javadoc/com/codename1/javascript/package-summary.html

You use the multipart request in the Java side of the code.
Reply all
Reply to author
Forward
0 new messages