in reply to Re^6: Renaming an image file
in thread Renaming an image file

fore sure, but if that is the case, why store it in the same directory? or why rename the file at all?

Replies are listed 'Best First'.
Re^8: Renaming an image file
by JavaFan (Canon) on Nov 28, 2010 at 23:28 UTC
    I neither know, nor I care. But just because *I* wouldn't do it, or I cannot imagine why someone else does it, I'm not going to recommend a solution to a problem that may lead to lost data. I think it's very bad advice if on the question "how do I create unique filenames", one gives a solution that may lead to data loss.

      Correct me if I am wrong, but if you have filenames of the form user_nnnnn.jpg, and you rename them to the form user_md5.jpg, the only "loss of data" that could occur is if a user has uploaded the same file under two different names?

      Or the 1 in 34 undecillion (billion, billion, billion) chance that the same user uploaded two different files that hashed to the same md5.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Correct me if I am wrong, but if you have filenames of the form user_nnnnn.jpg, and you rename them to the form user_md5.jpg, the only "loss of data" that could occur is if a user has uploaded the same file under two different names?
        Yes, that's exactly the point morgon is making when warning against the suggestion to hash on file content instead of file name in one of the ancestors of this post.