Android Question UploadFileinWebView: FileProvider: Error

jkhazraji

Active Member
Licensed User
Longtime User
Hi everyone,
I am trying to upload file with webview depending on: https://www.b4x.com/android/forum/threads/upload-files-with-webview.98623/
However I am faced with the error: java.lang.IllegalArgumentException: Expected receiver of type b4a.example.main, but got java.lang.Class<b4a.example.main> as I pick the file. It is an image file intended to be uploaded to the web page for further processing. I tried many solutions, none worked. Anybody has the solution please.
The line causing the error is:
B4X:
    jo.RunMethod("SendResult", Array(Provider.GetFileUri("TempFile"), FilePathCallback))
Thanks
 

jkhazraji

Active Member
Licensed User
Longtime User
Here is the HTML file:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
  <h1>Upload a File</h1>
  <form action="/upload" method="post" enctype="multipart/form-data">
    <label for="fileInput">Choose a file:</label>
    <input type="file" id="fileInput" name="file">
    <br><br>
    <button type="submit">Upload</button>
  </form>
</body>
</html>
 
Upvote 0
Top