Replacing files in a File Manager fileset

Permalink
I'm working on an "automated job" to replace files in a File Manager fileset with updated versions of them. These are made available on our web site as downloads, and we need to update them periodically with any new ones found in the source location of these documents.

I was just deleting and replacing them, which works fine as far as the file names go, but the add-on block we're using to display the links to them in our pages refers to them by their fileID, not their file name. (Which is probably good, since it's possible to have more than one file with the same file name.)

The problem is, every time we run the update, all the links to the files break.

Can anyone suggest the best way to programmatically replace existing files under the same fileID?

Also, do I need to set version numbers each time the update runs?

Thanks!

landollweb
 
enlil replied on at Permalink Reply
enlil
another option could be the front end file uploader add-on. I use this on my current project! It can be set to replace existing files, and works well, allowing certain users to upload right from the front end of the site. It's still a manual process, yet it's much simplified from how it was being done previously!!
landollweb replied on at Permalink Reply
landollweb
Thanks, enlil, I will check that out for other functions we may need. Unfortunately, for this one, we really need it automated, because of the number of files and frequency of updates.

I've been searching in the file API for something like a "replace" function, but I don't find any such thing so far. So it looks like I'll have to do something like...

check the fileset for the presence of the file name I'm updating,
get the fileID, and either:

- remove the file being updated, copy in the new version, and (somehow) set the fileID, or
- copy in the new version of the file with the same file name and fileID (again - somehow) and increment the version.

Not sure if I'm on the right track or not, but still searching for some kind of basic process of handling this...

Thanks!
landollweb replied on at Permalink Reply
landollweb
Any other ideas...?