I use this function:
function sec_move_uploaded_file($tmp_name,$dir, $name) {
if(file_exists($dir.'/'.$name)) {
$ext=strrchr($name,'.');
$basename=substr($name,0,strlen($name)-strlen($ext));
$i=2;
while(file_exists($dir.'/'.$basename.$i.$ext) ) {
$i++;
well,
a) use a table in the DB with the primary key (id) as an auto-increment
column. 1, 2, 3 etc. Use this ID as the name of the file 1.jpg, 2.gif, and
perhaps store the filetype / extension as well, so that you know what
filename to look for in the folder.
b) something as simple as file_exists
Davíð Örn Jóhannsson wrote:
I have a situation where I allow users to upload images, and I store the
names of the images in a database and the images I store in a some
folder on the server, but what I would like to do is to dynamically
create names for the images and dont ever have to worry about
On Thursday 05 December 2002 00:48, Davíð Örn Jóhannsson wrote:
> I have a situation where I allow users to upload images, and I store the
> names of the images in a database and the images I store in a some
> folder on the server, but what I would like to do is to dynamically
> create names for t
I have a situation where I allow users to upload images, and I store the
names of the images in a database and the images I store in a some
folder on the server, but what I would like to do is to dynamically
create names for the images and dont ever have to worry about if this
name exists and with
5 matches
Mail list logo