Welcome Guest Search | Active Topics | Sign In | Register

HOWTO Get full file path from <input type=file> object. Options
JSB
Posted: Wednesday, February 1, 2017 9:14:56 PM
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?
eo_support
Posted: Thursday, February 2, 2017 8:26:40 AM
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.aspx

You 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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.