Gets the encrypted filename for a particular attachment.


void getAttachmentFilename (string $filename, int $attachment_id[, string $dir[, bool $new]])

Parameter $filename

Expected type: String
Description: The name of the attachment we're looking for

Parameter $attachment_id

Expected type: Integer
Description: The id of the attachment (set to 0 to return only the "clean" filename - see notes)

Parameter $dir

Expected type: String
Description: The directory within the attachments directory where this file should be (only set if we're using multiple attachment directories)

Parameter $new

Expected type: Boolean
Description: Indicates whether this is a new attachment or one that already exists (default is false)


  • Tells SMF what the encrypted filename is for a particular attachment
  • Sets $clean_name (the actual name of the file) and $enc_name (the encrypted version of the filename)
  • If $attachment_id is 0, or if $new is true and you've told SMF not to encrypt filenames, returns the orignal (non-encrypted) filename
  • Otherwise if $new is true, returns the encrypted filename
  • If $attachment_id isn't 0 or $new isn't true, returns the full path to the actual file (first it checks for one with the encrypted name, then it checks for one with the "clean" name)
  • If the attachment can't be found, the original value of $filename is returned
View all versions of this function