How do you get files from device for CustomWebView.FileUploadNeeded()?

@vknow360 pls help me with this topic.

I'm having problems with this method.

I want to let files to be uploaded just as files are uploaded from device in other app and chrome.

Also, could you get me a code snippet ?

I'm stuck at this point :

I'm making a browser of my own actually and want to upload files into the browser just as this :

After clicking on documents :

Please help me.

Show a bottom sheet or dialog containing whatever you want user to choose files from and wait till user returns to app with file path or uri and then pass that with UploadFile method.

@vknow360 How could I do that ?

Do a little search in the community, I can't provide you blocks directly.

Can I set mimeType to *?
Can I do that to represent multiple mimetypes ?

Pls Reply.

You provide the file mimetype to set the...mimetype when the file is saved on the "uploaded to" server. Most servers require this information. I believe the upload block automatically provides the mimetype from the file extension.

I know it provides but actually I want to allow the user to select files of all mimeType on their device even if they get an error. (This is what actually happens in Chrome too.)

Do you think this will work ? (I can't test it myself cuz I can't connect to AI2 Companion bcz my laptop has got some internal errors and I'm using MIT AI2 on my android. :sweat_smile: [ You can't even imagine how hard it is to use MIT AI2 in a mobile phone. :cry: ])

My ActivityStarter's name is FilePicker and its activity is set to android.intent.action.GET_CONTENT

It will work. But you need to add a condition there, if mimeType is empty then set DataType to */* else set DataType to mimeType.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.