function upload_file($tmpfile) { //create a hash of the file $filehash = sha1_file($tmpfile); //we assume the file is a jpg $targetfile = $this->filedir . "/" . $filehash . ".jpg"; $success = move_uploaded_file($tmpfile, $targetfile); if (!$success) { EgoLib::exit_error("could not save file"); } return $filehash; }