Good evening,
I have a plugin that presents a filemanager for the user to upload a file. I store it. All works as desired. I can even retrieve it.
I do retrieve and write it to disk for various things to be done to it. But after all of this work I want to upload the modified version back to mdl_files overwriting the existing file--the one I just downloaded.
I've tried $fs->create_file_from_pathname but of course like the footnote in the documentation states (although a little confusingly) you have to delete the original file first before you can do this one. It will work. But it updates/changes the file id which causes me issues for various reasons.
So I tried replace_file_with() on the file I download. Doesn't work as the file has to be a "stored file".
So is there really no way to programmatically download a stored file, change the contents, and write it back, overwriting what was there already without changing the file id?
Thank you.