XF 2.1 file_hash value in xf_attachment_data


Active member

I'm trying to import data to xF2 from a custom PHP script, using a PHP (not xF) file. Everything works fine, except one value in xf_attachment_data table. Even if I'm able to store all fields there, can't understand how to prepare the file_hash value.

Just in random I tried using md5() function, but most probably is not correct as I can't see thumbnails in listings.
$file_hash = md5($photo_parts["filename"]); // This just the photo filename without extension
Does anyone know what PHP function I must use? Or if it's md5 maybe it needs other data except the filename?

Thank you