How to do a folder dialog in Web?

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.Text=t
  fldGatePath.TextAlign = Label.AlignLeft
End If

Thanks in advance!
Tim

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.

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.

Thanks,
Tim

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

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?

Tim

Access data from the server itself or clients computer?
Big difference :wink:

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.

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.

Tim

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

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

The example here will probably suffice :
http://documentation.xojo.com/index.php/FolderItem.Item

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