How to do a folder dialog in Web?

  1. 11 months ago

    Tim S

    15 Apr 2018 Pre-Release Testers, Xojo Pro Phoenix Arizona USA

    Hello all,

    What is the proper way to do a Folder Dialog, so a folder item can be selected from within a Web App?
    Something like this which is used in a regular desktop app:

    dim dlg as SelectFolderDialog
    dim f as folderitem
    dlg = new SelectFolderDialog   //create the dialog (does not actually show it)
    dlg.InitialDirectory = app.ExecutableFile
    Dim l as Integer = Len(App.LicensePath)
    Dim S as string = Mid(app.LicensePath,1,l-8)
    dlg.InitialDirectory = GetFolderItem(s)
    //The OpenDialog class supports custom prompts…
    dlg.PromptText = "Please locate the path where the PMS will drop the interface file."
    dlg.Title = "Gate Folder Location."  //…and custom title's
    f = dlg.ShowModal
    //then test for nil to see if the user clicked cancel
    if f <> nil then
      Dim t As String
      t = f.AbsolutePath
      fldGatePath.TextAlign = Label.AlignLeft
    End If

    Thanks in advance!

  2. Michel B

    15 Apr 2018 Pre-Release Testers
    Edited 11 months ago

    There is no such thing in Xojo Web.

    To save a file create a webfile pointing to a folderItem, and use webfile.url in a link. That will trigger the save as download dialog.

    To send files to the server, use the file uploader control.

  3. Tim S

    16 Apr 2018 Pre-Release Testers, Xojo Pro Phoenix Arizona USA

    Hello Michel.

    I'm trying to select a folder to save the location in a database - not actually looking to find a file. Any idea how to get a list of folders? That's what I really need.


  4. Michel B

    16 Apr 2018 Pre-Release Testers

    You don't understand. The browser never has access to the file system. You cannot get a path.

  5. Tim S

    16 Apr 2018 Pre-Release Testers, Xojo Pro Phoenix Arizona USA

    Hi Michel.

    Well that is a PIA. I need to tell other parts of my systems where to access data from. The hardware is headless, so was relying on the Webapps GUI....

    No way other way to do it?


  6. Albin K

    16 Apr 2018 Europe (Sweden)

    Access data from the server itself or clients computer?
    Big difference ;)

  7. Michel B

    16 Apr 2018 Pre-Release Testers

    Normally, a web app can only get data from it's own server's file system, or from a web space.

    If your device has enough memory, you could store the database on it. It would still be possible to store a backup on the user machine by download, or to upload that file back through the File Upload control.

  8. Tim S

    16 Apr 2018 Pre-Release Testers, Xojo Pro Phoenix Arizona USA
    Edited 11 months ago

    Hi guys and thanks for responding!

    What I am trying to do is get a path - from the file system that the web app is running ON. No data. The path is saved as part of setups in the web app database which is *also* accessed by another app on the same computer.

    ie the web app acts as a GUI for a console app on the same computer as the web app. The user simply needs to be able to see and select the folder/path to save in the database. This is all server side stuff (at least thats what I think you call it!). The user's file system is not the target and is not cared about at all.....

    Think of it as a standard desktop app - the user is distant in this case, but all they are doing is finding and selecting a local folder, and then saving the path in the local database.


  9. Albin K

    16 Apr 2018 Europe (Sweden)

    In that case, you need to create your own "select folder" dialog. Using WebListbox should not be that difficult :)

  10. Michel B

    16 Apr 2018 Pre-Release Testers

    Indeed a simple weblistbox could be used to select a path.

    The example here will probably suffice :

    For security reasons,I would tend to limit the possibilities of navigation to inside a users folder.

or Sign Up to reply!