|
#1
|
|||
|
|||
|
I would like to use the FileItem object or something similar to select a file and get the file path after it is selected it and pass it to a function. I have no need to upload anything, I would just like to expose a way for a user to select a file to be opened by a plugin.
Is FIleItem the proper tool to use for this? If so, what event(s) can I add a listener for to extract the path (as a string if possible)? Additionally, can the text field that displays the value be hidden? Thanks, Last edited by ls3674; 16th Mar 2012 at 14:18.. |
|
#2
|
|||
|
|||
|
This is fraught with peril, as attempts to access the value of a native upload control will return either nothing, just the leaf file name, or the full path. In the future, standardization is likely to lean toward exposing as little information as possible until the user actually starts the upload, especially since it's now so easy to accidentally drag and drop a file.
Probably the safest thing is to show a hint to the user explaining a foolproof way to get to the full filesystem path in their current OS. |
|
#3
|
|||
|
|||
|
Perhaps a hidden <input type="file"> and a JSNI method to dispatch it's clicked event might work. Any thoughts?
|
|
#4
|
|||
|
|||
|
Unless we're missing something about your approach, that can't work - for security reasons you can't get a value into an upload control unless the end user actually does it.
|
|
#5
|
|||
|
|||
|
Perhaps I did not explain correctly, but I did mention that
Quote:
This plugin is controlled via javascript, e.g. openFile("c:\\myfile.mpg"); I would like to pass the function openFile(); the contents of a file chooser as a string. |
|
#6
|
|||
|
|||
|
Right - so you can't reliably get a full filesystem path from the native HTML upload control (input type="file") no matter what. This is a core limitation of the web platform.
Options are: 1. just encourage / guide the user to navigate to the file using normal OS methods (eg Windows Explorer) and copy/paste it's path into your app 2. deliver a signed applet, Flash control that asks for special permissions, or similar approach that allows you out of the browser sandbox |
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visual Builder hanging | p27939 | Installation | 11 | 7th Mar 2012 11:08 |
| Launching Visual Builder in samples | RevMen | Smart GWT Technical Q&A | 10 | 9th Sep 2011 10:05 |
| UploadItem: how to configure the file chooser | jpaumard | Smart GWT Technical Q&A | 0 | 29th Mar 2011 09:43 |
| FileDownload question | acarur01 | Technical Q&A | 11 | 18th Mar 2010 13:33 |
| UploadItem marked as required in a DynamicForm | Nick Mogielnicki | Technical Q&A | 7 | 16th Dec 2009 06:57 |