Create Dynamic Folder on File Upload

I can't seem to get around this. I want to have a file upload which is easy. But I want the upload to create a new folder based on the id of the profile it is being uploaded to.

1: How do I create the folder?
2: What is the folder already exists, will it just upload to that folder or create a duplicate folder?

Alternatively, is it possible to add the profile id to the front of the file name on upload?

For example ....

I'm on profile id 1234 and I want to upload a file named 'myFile.pdf' and have it renamed to '1234_myFile.pdf'?

Hi Brad. Just put the variable into the path when saving the image:

So you don't need to explicitly create the folder, it will be created automatically if it doesn't already exist. If it does exist then the upload will go into the existing folder.

The screenshot also shows how you might name the file, too.

1 Like

Use a dynamic expression in the path:
Screenshot 2025-02-25 at 19.51.44

Enable the Create path option:
Screenshot 2025-02-25 at 19.52.02

So what I am gathering from both of you is I don't need to use the 'Create Folder' action at all? It will automatically get created using the variable?

2 Likes

Thanks guys! I haven't tested it with a dynamic expression yet but with a static value it works perfectly.

Much appreciated. Wappler rocks! :beers:

1 Like