I want to creat a CloudDeployed FormFunction which lets a user give the path to a directory on their local computer as an input. I have tried the following, FormFunction[{"root" -> "Directory"}, #root &], just as a test.
The active form has a Browse... button for the user to select a directory. But when browsing the computer, it doesn't actually let me choose a directory path to give as input. I'm not sure how to describe the issue, but it just keeps going further down the file path, not actually selecting the folder as input to the form.

What I would like, is for #root to be set to a file path from the user's machine. For example, "C:\\Users\\rossk". I understand that accessing a user's files can be sketchy, but I will make the source code available on the form, and explain the purpose of the form to users. Please let me know how I can resolve this.

  • $\begingroup$ "Directory" is not listed in ref/Interpreter supported forms. We could plug a html+js based solution but I see a problem here, your app won't be able to do much with the root because it can't have access to it. You'd need to upload files or an archived dir. $\endgroup$
    – Kuba
    Jan 15, 2021 at 7:45
  • $\begingroup$ It appeared in the autocompletion for accepted forms, and the form object lets the user browse their files to select one. So it should work for something. Maybe root is a bad name, I am just referring to a folder containing Markdown files. I see that an archived dir looks like it could work. Basically, I just need to import all the markdown files in a specified folder, and any subfolders. $\endgroup$ Jan 15, 2021 at 7:51
  • $\begingroup$ @Kuba I have created a .zip folder containing the .md files and other subfolders themselves containing .md files. I refer to this main folder as the "vault". When I run `Import["path\to\vault.zip"], it returns a list of all the file paths in the vault folder. This is partly what I want, but I also want to access the actual text in the .md files. $\endgroup$ Jan 15, 2021 at 8:04
  • $\begingroup$ Please take a look at reference.wolfram.com/language/ref/format/ZIP.html $\endgroup$
    – Kuba
    Jan 15, 2021 at 9:02
  • $\begingroup$ Thank you. I've managed to get it working from a Zip folder when using my pc. But when I try import a zip folder into Wolfram Cloud I get the error: Import::nffil $\endgroup$ Jan 15, 2021 at 9:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.