Re: Getting a "unique identifier" for a file

From: Date: Mon, 30 Jan 2006 01:32:06 +0000
Subject: Re: Getting a "unique identifier" for a file
References: 1 2 3 4  Groups: php.windows 
Request: Send a blank email to php-windows+get-26662@lists.php.net to get a copy of this message
SamuelDr a écrit :
SamuelDr a écrit :
Hi back, Manuel Lemos wrote :
Hello, on 01/28/2006 08:31 PM SamuelDr said the following:
Hi ! I'm trying to develop something in PHP. I have a list of file, and I want to know if I can have a unique identifier for each files. What I mean, is: I have my files:
    test.txt
    test2.txt
I would like them to return a unique something... anything...
tempnam ?
No, actually, I do not want to create a new file, I want to associate a certain file to a certain row in a DB. I want to do some windows desktop like web application for active desktop, and want to know if there could be some sort of way to have a unique identifier to each file. I would want this because, take this example in account : I have dowloaded a file, movie1.avi . I delete it. 2 hours later (the wipe in the DB for old file entries is not done) I download another file with the same name. It would be place at the place of the old one ! Maybe by checking the creation date, and the filename, that would be possibkle... only quirks : if you rename the file not from the web interface... it would place itself like a new icon.
I have received this in my mail inbox... I saw that it was not there : I can think of that would get you a unique ID for a file that does not rely on the name being unique... 1) filename + creation date 2) filename + md5 hash of the contents the first would be possible... I think. But the second, if someone modify its files, they would get back to their default position. Thanks anyway !
I have received this in my inbox :
SamualDr, You could get an MD5 hash of the file. It is extremely difficult for two different files to have the same hash. Paul
It would be a good idea if my files were not meant to be modyfied, but it seems that files on the desktop WILL be modified... So, i'm still looking for something.

« previous php.windows (#26662) next »