Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Selecting a Folder.
Sat, Sep 28 2013 3:41 AMPermanent Link

Steve Gill

Avatar

Hi Tim,

The TFileUploadButton can be used to select a file, but is there any way to select a folder?  

I have embedded a web server into a Windows service, and I'm using EWB for the browser interface.  The interface will allow a user to specify various settings and I want the user to be able to select folders as part of this.

Thanks,

Steve
Sun, Sep 29 2013 4:44 PMPermanent Link

Matthew Jones

<Steve Gill> wrote:
> Hi Tim,
>
> The TFileUploadButton can be used to select a file, but is there any way
> to select a folder?  
>
> I have embedded a web server into a Windows service, and I'm using EWB
> for the browser interface.  The interface will allow a user to specify
> various settings and I want the user to be able to select folders as part of this.

I don't know if a browser can show a folder selector, but the main
consideration must surely be that the service may not have permissions to
the same folders as the user. I'd suggest that you get a list of folders
from the service, and make a UI in EWB from that.

--
Matthew Jones
Mon, Sep 30 2013 1:27 AMPermanent Link

Steve Gill

Avatar

Hi Matthew,

<< ...but the main consideration must surely be that the service may not have permissions to the same folders as the user. >>

That's always a possibility but I've never had problems with any of the Windows services that have been in use by my clients for several years now.

<< I'd suggest that you get a list of folders from the service, and make a UI in EWB from that. >>

Thanks but I'm not sure if that would be practical.  That could be a lot of folders.

- Steve
Mon, Sep 30 2013 9:59 AMPermanent Link

Raul

Team Elevate Team Elevate

On 9/28/2013 3:41 AM, Steve Gill wrote:
> The TFileUploadButton can be used to select a file, but is there any way to select a folder?
> I have embedded a web server into a Windows service, and I'm using EWB for the browser interface.  The interface will allow a user to specify various settings and I want the user to be able to select folders as part of this.

I assume this if to return a folder on the client computer (one running
EWB and browser)?

If so AFAIK it's not possible with the normal browser permissions  -
browser sandboxing prevents exposing even folder names in general (file
upload button should see just filename and no info on path).

Using something very specific (for example IE and manually disabling
enough security settings by allowing scripts and such to run) might
allow something like this to work though i don't have specific examples.
Or embedding java or flash btu then you still would need to communicate
back to ewb app.

Raul
Mon, Sep 30 2013 8:11 PMPermanent Link

Steve Gill

Avatar

<< I assume this if to return a folder on the client computer (one running
EWB and browser)?

If so AFAIK it's not possible with the normal browser permissions  -
browser sandboxing prevents exposing even folder names in general (file
upload button should see just filename and no info on path).

Using something very specific (for example IE and manually disabling
enough security settings by allowing scripts and such to run) might
allow something like this to work though i don't have specific examples.
Or embedding java or flash btu then you still would need to communicate
back to ewb app.  >>

Ok, thanks Raul.  Perhaps I'm misunderstanding this whole thing but, from *within a browser*:

* I can navigate through drives and folders to select a file to upload.
* I can download a file from a website and save it on my computer, navigating to a folder on whatever drive I like.
* But I can't just select a folder?

- Steve
Tue, Oct 1 2013 9:55 AMPermanent Link

Raul

Team Elevate Team Elevate

On 9/30/2013 8:11 PM, Steve Gill wrote:
> Ok, thanks Raul.  Perhaps I'm misunderstanding this whole thing but, from *within a browser*:

The actual browser executable yes has access to your local drive. Not
the JS apps running inside the browser sandbox. if JS had this access it
would result in all kinds of security issues - apps sniffing your file
system etc. In general there is no file system access at all from JS.
You'd have to

> * I can navigate through drives and folders to select a file to upload.

Yes but this is done by the browser (not your app) and once you select
the file the browser even removes all folder related info so once you JS
app gets the info back it just gets the file content and name (and
possibly mime type).

> * I can download a file from a website and save it on my computer, navigating to a folder on whatever drive I like.
Again the browser handles that - you can't do it from JS direct.

> * But I can't just select a folder?

Not at the moment. Main reason is that it's not a common nor useful
feature for the web apps. I do realize it's important to you but in
general JS apps can't do anything with it (even if they knew the folder
there would be no way to read or even list files) and it's of course
platform specific (windows and linux paths are different and on mobile
device this might not even be supported to be being with).

HTML5 is adding a FileSystem API but i believe it's again special
sandboxed version and not full file system.

If you need it today AND your customers run IE AND you can have them
allow scripts to run you could look into Windows Script Host to
accomplish this.

Using something like this :
http://www.zhihua-lai.com/acm/vbscript-browse-for-folder-using-shell-application-object/

and then WSH access would be similar to the way ShellEecute discussion
went here:

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&msg=3636&page=1

I have not tried but the other issue will be getting the path back.

Other options are custom browser extension that you could access (but
you'd have to write it and would work with that browser only) or
embedded Flash or Java applet (would need runtimes again for those).

Raul

Tue, Oct 1 2013 9:34 PMPermanent Link

Steve Gill

Avatar

Hi Raul,

Makes sense.  Thanks for the detailed explanation.

- Steve
Image