Handling filenames in DB + File and keeping in Sync

Okay I got the file upload working. Earlier I used BLOB’s and handled filetype with DB in META field, so I could store just anything I wanted without taking care about filesystem / structure.

But now I want to use Filesystem + DB:
I forgot the reason why, but I guess I had a reason for the following: I want to save a filename as hash in DB and symetrically also as File. I know I can use {guid}{ext} but thats not what I want. And in DB I cannot get the variable of the {guid}.?? Ok I can Code it, but: how to store Files as Hash in DB and as 435ed7e9f07f740abf511a62c00eef6e.jpg with wappler features?

Hi Freddy,
Just out of curiosity - why would you need to store the filename hashed in the db?

I guess if a filename already exists or if user wants to upload several files. Should i go with {guid}? But whats the best practice?

But if the file exists - then the file will be renamed automatically to: filename_1.jpg on upload - you don’t really need hashing it.

Okay makes sense, and storing the new/renamed value will take which variable field then?

The new name is automatically passed to the insert record step.

strange its not saving the new filename. Just the “sourcefilename” how it was called… :roll_eyes:

  1. Check if overwrite is not selected in file upload step
  2. What is the expression used as a value for the insert step?