|
Post by louisatome on Jun 2, 2017 8:38:39 GMT
Hi,
Is there a way to allow WKWebView to access file path when select files from an <input> file element? I would like to known which file(s) the user has selected and send that information to Ruby-side.
Thanks,
Louis
|
|
|
Post by Dmitry Soldatenkov on Jun 2, 2017 13:05:09 GMT
you should make on change listener for this field and call ruby controller via ajax request
|
|
|
Post by louisatome on Jun 6, 2017 7:33:06 GMT
The problem is, in the on_change listener I cannot access to the absolute path of the selected files. So I need to read the file with a FileReader and send the data to Ruby which can be a problem with large files.
|
|
|
Post by Dmitry Soldatenkov on Jun 6, 2017 12:10:24 GMT
Please show me your filepath in input field (run app on device please)
|
|
|
Post by louisatome on Jun 6, 2017 13:18:23 GMT
That's what I would like to do :
$("#myFileInput").on("change", function(ev){ const files = this.files; for(var i=0; i<files.length; i++){ var file = files[i]; console.log("Selected file name : "+file.name); console.log("Selected file path : "+file.path); } });
But the path property is null. This property is disabled in web application for security reason but as we are in local mode with rhodes, maybe we can disable this security in WKWebView config ?
|
|