Add a lowercase to file upload step

Small thing that would really help, adding a toLowerCase at image upload step.
2021-12-16_19-11-46

If it could perhaps do {name} and {ext} to lowercase it would be really handy.

If I had this I would not need formatters to work inside the {name}{ext} Template part as badly.

We use {guid}{ext} for uploads to avoid naming conflicts (renaming the files on upload), the likelihood being that no two file names will be the same. Especially important as Users tend to use the same file names quite a lot, and mistakes can always be made even if a single User has access. So when updating we check if the file name exists and can be pretty certain this is the file to overwrite (we include a uid as part of this confirmation)… May I ask if you do not see overwrites (accidental or otherwise) taking place, within the images directory, lets say if two Users were to upload profile.png, or image1.png, for example?

1 Like

There are some applications where a user will have their own folder based on their user id (created if it doesn’t already exist) and the file is stored with the original filename. This avoids having to store original filenames in a DB and matching back up when downloading and the user only has an issue if clashing with their own file. Having said that, I do try and avoid this where possible…

Yeah, I have concerns with duplicate file naming for sure and guid will certainly fix that, the problem I find is that I am generally creating content management type systems that are controlling the front end of a site wanting to get the best SEO possible, and because image names and alternate text are a small SEO metric and because i want Google Images to crawl me, I do not want filenames like, guid.jpg.
I just find the image upload steps so seamless in Wappler, however this one little missing thing causes me endless headaches, especially when it comes to upper or lowercase file extensions.

Scenarios I hit are when I want an upload named my-upload.JPG to save out one copy to an original uploads directory and for it to create a second copy as a thumbnail, and for some reason the original retains its uppercase JPG while the autogenerated thumbnail gets a lowercase jpg extension.

As I say the current upload procedure with images at least is so easy, yet this one thing keeps being the cause of many issues, I mean yes, I can get around it with SetValue steps to use the formatters etc. but it makes far more steps and far more brain power than it maybe should.

The first step File Upload would be the perfect place for the rename to happen as then that. name is bound to almost every other step with its name, path, url bindings, and also, while the Save Image step can be bound to save the name to the database down the line.

Basically it just seems a shame that the upload procedure with resize, crop, cover fit, save, takes about a minute to implement, and then i mess around with file naming for another hour afterwards, and seem to have never quite gotten it right as I still get bug reports where its often file name related. I just got one a few hours ago which prompted this post, however that actually turned out to be something to do with Sharp not handlng HEIC codec, which is the first time I have seen that, had to open the image in Apple Preview and resave it to get it uploaded.

1 Like