Page 1 of 1
hashing file name
Posted: Mon Aug 20, 2007 8:43 pm
by m2babaey
Hi
i noticed file uploads hash the file names. why do they do this? or maybe i didn't get that correctly
Posted: Mon Aug 20, 2007 9:46 pm
by superdezign
I'm not completely sure, but it's like a signature. It helps you avoid running viruses by comparing the signature of the file that you downloaded with the signature that they tell you is valid. Combined with the correct file size, I'm sure it's extremely difficult to duplicate the same signature in a virus as the valid file.
Posted: Mon Aug 20, 2007 10:03 pm
by RhapX
They do it so there isn't a duplicate of it on the server. Usually I will rename a file to the timestamp. That way you know when it was uploaded and there will be no duplicate or overwriting going on.
Posted: Mon Aug 20, 2007 10:09 pm
by superdezign
RhapX wrote:Usually I will rename a file to the timestamp. That way you know when it was uploaded and there will be no duplicate or overwriting going on.
What if two files are uploaded at the same time?
Posted: Mon Aug 20, 2007 10:11 pm
by RhapX
It has an _ and then the number of the file from the batch:
1187665966_1.ext
superdezign wrote:RhapX wrote:Usually I will rename a file to the timestamp. That way you know when it was uploaded and there will be no duplicate or overwriting going on.
What if two files are uploaded at the same time?
Posted: Mon Aug 20, 2007 10:32 pm
by s.dot
I do somewhat the same for images
Code: Select all
$name = time() . substring(md5(microtime()), 0, rand(5, 10) . $ext;