What potential pitfalls can arise from using a kryptic file naming convention, such as using an MD5 hash as a filename in PHP?

Using a kryptic file naming convention like an MD5 hash as a filename in PHP can make it difficult to identify and manage files. It can also lead to potential collisions if two different files generate the same hash. To solve this issue, consider using a more descriptive filename or storing the original filename in a database and linking it to the hash.

// Generate a unique filename using a combination of timestamp and original filename
$original_filename = "example.jpg";
$timestamp = time();
$unique_filename = $timestamp . '_' . $original_filename;

// Save the file with the unique filename
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $unique_filename);

// Store the mapping of original filename and unique filename in a database
// This can be useful for retrieving the original filename later