10

I want to upload a static image on select of button (as described in below screenshot) <input type="file"> on the web url from my app using WKWebView.

On click of Choose File button it will open default action sheet of device and after the selection of image, it will be uploaded on server. I want to interrupt the flow and upload my static image instead of user's selected image.

enter image description here enter image description here

Is there any observer or listener so from there we can handle request and response. Upload an image using form-data API is not available.

ios_dev
  • 957
  • 13
  • 26
  • I know this is not going to solve your issue, but what exactly are you trying to achieve? Why have a file input if you will ignore it? Why not just send your static image to your server without this useless interaction? – Mihai Fratu Sep 08 '18 at 20:13
  • The problem is we don't handle the server and it's the requirement @MihaiFratu – ios_dev Sep 10 '18 at 04:04

1 Answers1

0

You can get a callback from webview's element click action but you need to play with JavaScript code and the JSVirtualMachine which will help to get a callback in your swift class. and then you can do any action on click as like normal action

You can follow this link enter link description here

Rakesh Mandloi
  • 341
  • 2
  • 11