Rank: Advanced Member Groups: Member
Joined: 1/2/2017 Posts: 32
|
Please help,
We purchased the EO Web Browser control SDK, and need to get the full path from <input type=file> objects into JavaScript/JQuery.
With the Windows Web Browser control, we could use simple JQuery on a <input type=file> object, as such:
<html> <input type=file id="MyFileInput"> <script> $("#MyFileInput").change(function(e) { alert ( " - Full File Path like [C:\\MyFolder\\MySubFolder\\MyFile.ext] = [" + this.files[0].fileName + "]...\r\n" ); } </scipt> </html>
But the EO Web Browser control does not support the "fileName" and only returns the file's name without the path in the above "this.files[0].name", and returns "C:\fakepath\filename.ext" in the $(this).val().
Can we get the full path with EO?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, Currently there is no way to get it directly through the input element because the security constrains Chromium browser engine put on file input element. However you can get it indirectly by handle this event: https://www.essentialobjects.com/doc/eo.webbrowser.webview.filedialog.aspxYou can replace the built-in dialog with your own dialog thus get the the file name on C# side. After that you can call WebView.QueueScriptCall to pass that value to the JavaScript side. We will also look into the possibility to allow you access the actual file name in JavaScript side without compromising browser engine security. Thanks!
|