Dynamically select file directory

Hi There,

I’m building a contract repository where a client will upload a series of contracts into backendless file storage. Right now I can point these files to a static directory, but this will result is a junk drawer sort of scenario where there are a ton of contracts in the same folder and could create permissions issues where users would be able to see each others contracts. In a perfect world I’d be able to create or select the directory based on the client name.

If I were to set the Client name to page data, is there a way I could set the directory name to that client name each time?

Has anyone encountered anything similar?

Hi @Aaron_Alpeter

For the component, there is the “Target Directory Logic” logic handler which you can use to determine the path of the directory where the file(s) will be uploaded to.

Regards,
Vlad

Thanks Vlad- are there any resources you could point me to that would help me understand the inputs/outputs for this block? I couldn’t find a video.

I’m getting an error telling me that I’m using forbidden symbols in my directory name. I’m essentially trying to create a subfolder within a main folder which is why I’m combining text.

Hi @Aaron_Alpeter ,

“Create text with” block performs concatenation and nothing more.

I’m getting an error telling me that I’m using forbidden symbols in my directory name

The next symbols are forbidden in the directory name: ./, ../, ., .., ", <, >, %, '.
If you get error “Path contains prohibited symbols” it means that resulting string contains at least one of forbidden symbols.

Regards, Andriy

Thanks Andriy,

Is there a different way to specify a dynamic file path for a sub folder? In theory I’d like to have all of these types of files grouped in folder instead of living in the root directory. Perhaps I need to break it into two parts: create the dynamic path in root and the move the file or folder to the sub folder?

@Aaron_Alpeter ,

Could you please clarify what do you mean under “dynamic file path”?

You can upload your file with required path and Backendless will create missing directories from file path if such will be present. There is no need to several API calls. Just ensure that file path doesn’t contain forbidden symbols. I want to underline that / itself is not forbidden symbol.

Hi Andriy

I’d like to organize my file directory to be root → contracts → location with “locations” being unique based on what was being saved. Said in other words, I’d like to have all of the uploads live in the subfolder of “contracts” vs on the root which appears to be the default with the blocks that I’ve chosen.

When it comes to forbidden symbols, I don’t quite understand where they are coming from the desired directory path above should be “Fulfillment Contracts/name.” Any idea where I should be looking?

Hello @Aaron_Alpeter,

Please make sure the name part of the directory path doesn’t contain the forbidden symbols.

Regards,
Olha