Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:41:54+00:00 2026-06-17T11:41:54+00:00

Possible Duplicate: What is a good way to check if an image is unique

  • 0

Possible Duplicate:
What is a good way to check if an image is unique using PHP?

A user uploads an image (png, jpg, gif) via a form. I’m am using hash_file to check against the db to see if the image already has been uploaded but I am now noticing that it is not unique.

Is this a bug or should I be using something else to generate a unique ID for the files?

I guess the workaround would be md5(filesize($file) . $hash)?

UPDATE
From the logs… first set is using md5_file, second from hash_file with sha256…

HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'd41d8cd98f00b204e9800998ecf8427e'
HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'd41d8cd98f00b204e9800998ecf8427e'

HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c
20130117T231016: booru.pixymedia.us/utilities/batchExistingUpload.php
HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c

And no the SQL is right… I’ve uploaded 3,000 files successfully with this function…

This is the hash generating code:

$fileHash = hash_file("sha256",$FILE["tmp_name"]);

$FILE is basically $_FILE, it’s just what the function parameter is named as

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:41:55+00:00Added an answer on June 17, 2026 at 11:41 am

    d41d...427e and e3b0...b855 are the MD5 and SHA256 sums of the empty string (e.g, md5("") and sha256("")). The fact that you’ve got these in your database indicates that there is something wrong with your code — you may be hashing the wrong filename at some point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP Arrays: A good way to check if an array is associative
Possible Duplicate: Best way to detect when user leaves a web page Check if
Possible Duplicate: Is this a good way to generate a string of random characters?
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Split string with delimiters in C I'm searching a good way to
Possible Duplicate: Generating all Possible Combinations Is there a good LINQ way to do
Possible Duplicate: I need a good way to get data from a thread to
Possible Duplicate: Preventing Brute Force Logins on Websites Limiting user login attempts in PHP
Possible Duplicate: filter using Q object with dynamic from user? I am working on
Possible Duplicate: Is there a good way to have a Map<String, ?> get and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.