Re: HTTP_Upload unique files

From: Date: Sun, 03 Oct 2004 22:46:56 +0000
Subject: Re: HTTP_Upload unique files
References: 1 2 3 4 5  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-33641@lists.php.net to get a copy of this message
Erik Heerlein wrote:
On Oct 2, 2004, at 5:44 PM, Ammar Ibrahim wrote:
Here are my suggestions, Which I hope anyone would give me feedback: 1) what should the "type" of this naming be? My suggested name is 'uniq_seq' which stands for, unique sequence
Well, that's a bit redundant isn't it because by default, any sequence is non repeating and therefore, unique. So 'sequence' would suffice I guess.
2) A new utility function needs to be written '_get_last_sequence($file_path)' This is helpful to get the last sequence number of a base file name e.g $last_seq = _get_last_sequence('userGuide.pdf') if the following files exist in the folder( userGuide[1].pdf,userGuide[5].pdf) the function returns 5 or false if no file exists with the same base name
What about being able to specify the starting number of the sequence? To start at something other than zero? Or pick where the number would go in the filename? Like suppose somebody wanted to do 'userGuide_6.pdf' or userGuide[f][6].pdf. I don't know if there would be a great need to do this I'm just wondering. Adding more control to files naming is a real need ! Thanks to Ammar.
As the goal is to give more control, we can go further. For the sequence / naming schema, i think it would be nice to let the user (of the package) decide by setting/getting a class property "pattern" e.g. $file->pattern='userGuide[%d].pdf'; or $file->pattern='userGuide_%d.pdf'; and/or after $last_seq = _get_last_sequence('newpattern%d.pdf').

« previous php.pear.dev (#33641) next »