File upload: force to overwrite with same filename

By: Tom Mendalka | Asked: 03/27/2023
ForumsCategory: General questionsFile upload: force to overwrite with same filename
Tom MendalkaTom Mendalka asked 1 year ago
I'm struggling to find an answer to a fairly simple question: is there a way to force overwrite previously uploaded file? Is it even possible? I have an upload form with a custom frm_upload_folder. If a file with the same name already exists, it should be overwritten on a new upload. Instead, the freshly uploaded file has the same name but with a -1 suffix, the next -2, etc. I will be grateful for any advice.
Larry Kolinek replied 1 year ago

Hi @Tom Mendalka
did you ever figure this out?

yes, I'm trying to do this exact same thing and SOOooo frustrating that FF is doing the odd behaviors, EVEN when you say "over-write".

I can write custom code, but wanted to ask first 🙂

thanks!!!

1 Answers
Victor Font answered 1 year ago
This is how WordPress works. So no, overwriting isn't possible without custom code. You will probably need to create a function that fires in frm_after_create_entry hook. Here's an example for renaming and moving files, you'll have to figure out how to delete the ones you don't want. https://formidableforms.com/knowledgebase/frm_after_create_entry/#kb-move-and-rename-files

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right