Forum OpenACS Development: Re: Re: problems with unique name constraint in cr_items -- file-storage

Ah yes; the filename is the URL. Seems like the desire to avoid URLs like "/storage/one-file?file_id=1234" creates some complications.

In any case, there already is a "BehaveLikeFilesystemP" parameter in the package, but this parameter right now only sets whether in folder-chunk a file's title links to /download/ or to /view/.

I suppose that some behaviors could be added to this parameter on the "file upload" side:

BehaveLikeFilesystemP = 1:
A new uploaded file that has a name conflict with an existing file would generate a new version of the existing file. This doesn't actually overwrite the old one (as you point out it would in a real filesystem) but it effectively does because it becomes the latest/active version of the file.

BehaveLikeFilesystemP = 0:
A new uploaded file that has a name conflict with an existing file would generate a new file, just as if there was no name conflict. Behind the scenes, it would modify the filename by appending an integer (ie if there already is a filename "myduplicate.doc" then the second uploaded filename would be "myduplicate-1.doc".

These upload and download behaviors could be controlled by their own parameters, though, too. That might be clearer and more flexible.