Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-07 22:13:12

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

File rename option

Currently the “Replace file” operation replaces the contents of the file in question, without changing the file name.

How about an option where it’s possible to change the file name as well?

In the scenario where you upload a brand new file called “Version 1” & then replace it with “Version 2”, you end up with a situation where “Version 1” contains “Version 2” data. If the user wants to retain the version number in the file name he has to upload it as a new file (duplicating it’s description, perms etc), remove the old file & possibly do some other edits to make it live.

If there was an option to change the file name, as part of the “Replace file” operation, life would be easier.

And if there was an independent facility to change the file name then when you get bored with maintaining version numbers you could change “Version 1” to “Current version” & be done with it!

Adi

Offline

#2 2010-02-07 22:35:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: File rename option

gomedia wrote:

How about an option where it’s possible to change the file name as well?

I like the cut of your jib. Caught me out recently when I replaced a file with a completely different file name of the same thing and it still showed up in the list with the old filename. Urk! I thought at that moment “wouldn’t it be great if…” and put that thought on the back burner while I tended to images.

I honestly don’t know why the file cannot be renamed. As far as I can tell, it’s always referenced by ID internally so the only link with the outside world is the file name itself. As long as the name column in the database can be kept in sync with what’s in the /files directory it should work fine. That implies quite a bit of overhead in terms of error checking that the file you’ve just uploaded doesn’t clobber a file elsewhere though… e.g. replacing v1 of a file with one called David_Hasselhoff_v2.jpg when there’s already a file of that name in the file system / DB.

If you fancy submitting a patch to save me the workload, please feel free :-)

EDIT: P.S.

Last edited by Bloke (2010-02-07 22:37:07)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2010-02-07 22:54:23

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: File rename option

Hi Stef,

Bloke wrote:

I like the cut of your jib. Caught me out recently when …

You can tell this the first time I’ve had to replace a file too … & I got a teeny bit confused!

Thanks for the “PS”. It looks like there might be the start of a groundswell of support?

Not sure if my workload would allow me to create a patch, sorry. I can pick holes, but someone else will have to fill them in!

Adi

Offline

#4 2010-08-30 13:59:48

fbox
Member
From: Melbourne
Registered: 2006-02-18
Posts: 42

Re: File rename option

I usually upload the files via FTP (I’m using TXP 4.2.0) and then visit the “files” tab to import them into the system.

Where I’ve needed to rename a file, I’ve found that I can manually rename the file on the server (no permissions issues because I uploaded it to start with) and thus cause the file status to become “missing”, which then allows you to re-associate a file to that file ID and thereby update the database with the new file name.

– L.

Offline

Board footer

Powered by FluxBB