createAttachment

Description

Inserts a new attachment into the database.

Syntax

void createAttachment (array &$attachmentOptions)



Parameter &$attachmentOptions

Expected type: Array
Description: An array of information about the attachment

Array Elements of $attachmentOptions
Key Optional Expected type Description
errors no Array Keywords indicating any errors that occurred with this attachment - can be 'can_not_upload', 'too_large', 'bad_extension', 'directory_full', 'bad_filename' or 'taken_filename'
name no String The name of this attachment
poster no Integer The ID of the member who posted this attachment
size no Integer The size of this attachment
thumb no Integer The ID of the thumbnail associated with this attachment (set after attachment is inserted; used for createPost and modifyPost)
tmp_name no String The name of the temporary file for this attachment
height yes Integer The height of the attachment (in pixels; not always set before attachment gets inserted)
id yes Integer The ID of this attachment (set after the attachment is inserted)
post yes Integer The ID of the post this attachment is associated with (defaults to 0 - it will get updated later if this is a new post)
width yes Integer The width of the attachment (in pixels; not always set before attachment gets inserted)


Notes

  • This is called from Post2() before any posting gets done
  • Creates a thumbnail if necessary
  • Handles all attachment-related error checking
Advertisement: