Getting a "unique identifier" for a file
6 answers - 662 bytes -

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
If I have my first test.txt, and delete it, and put another one, EXACTLY
the same file, but after deleting the first, I would like it to return a
"new id"
This "id" would be used to pair database entries for each files, but
without using an old entry for a new file.
I know it feels abstract, but if you want informations about what I
want, ask me !
No.1 | | 369 bytes |
| 
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.2 | | 1336 bytes |
| 
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.
No.3 | | 1798 bytes |
| 
SamuelDr a :
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 !
No.4 | | 2154 bytes |
| 
SamuelDr a :
SamuelDr a :
>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.
No.5 | | 2657 bytes |
| 
SamuelDr schrieb:
SamuelDr a :
>SamuelDr a :
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.
I think creation date will not work. If I create a file called
"test.txt" on my desktop, then delete it and then create another file
"test.txt" or rename an existing file to "test.txt", this file will get
the creation date of the firstly created file.
No.6 | | 2622 bytes |
| 
Christoph Kunze a :
SamuelDr schrieb:
>SamuelDr a :
SamuelDr a :
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.
I think creation date will not work. If I create a file called
"test.txt" on my desktop, then delete it and then create another file
"test.txt" or rename an existing file to "test.txt", this file will get
the creation date of the firstly created file.
K, thanks for this, it helps to know where not to look :P