WikiFile::uploadFile PHP Method

uploadFile() public method

$text is only used for the page contents of a new file, not an existing one (update that via WikiPage::setText()). If no $text is specified, $comment will be used as new page text.
public uploadFile ( string $path, string $comment, string $text = null, boolean $overwrite = false ) : boolean
$path string The file path to upload
$comment string Upload comment for the file
$text string The article text for the file page
$overwrite boolean True to overwrite existing file
return boolean True if uploading was successful
    public function uploadFile($path, $comment, $text = null, $overwrite = false)
    {
        // Read contents from specified path
        if (($data = @file_get_contents($path)) === false) {
            $this->error = array();
            $this->error['file'] = "Unable to read file '{$path}'";
            return false;
        }
        // Upload contents to current file
        return $this->uploadData($data, $comment, $text, $overwrite);
    }