I'm working on a project in vuejs where I basically need to provide a file selector (created by myself) that only displays the PDF files that are in the project's parent directory. For example, if my project is located in the directory & # 39; / projects & # 39;, all PDF files in that directory (& # 39; / projects & # 39;) must be displayed in the file chooser
-There is a desktop application that will be implemented later in electron-.
Anyway, to solve this problem, I tried different things, only one of which worked:
1. (works): Access the directories and list the files with nodejs from the back and send the information to the front. The problem is, it's a bit tedious to do this, in addition to what it takes to do a back-to-back project for such a small application, and that does not require very complex databases or logical operations.
Therefore, I would like to know if this problem can be solved completely from scratch. To access a particular directory, you must list and read its files.
Use an input-type file and, in a sense, define a home directory, such as: For example, the directory whose files I need to display so that the files in that directory already appear loaded in the input as soon as the page has been rendered so they can be accessed from the beginning without displaying the file selection associated with the input. The problem is that, as I've already learned, an initial input directory can not be defined because it would be a security issue.
I know that the question I ask does not imply too much doubt with a clear code sample or a very simple answer to that question. But I would like to know if anyone can help me by explaining what I should do, in general. Someone who can tell me which of the options I have chosen is the best and how to solve it, or if there is a better option and what it is all about.
Many thanks 🙂