Public Member Functions | |
ilBMFAttachment ($name= '', $type= 'application/octet-stream', $filename, $file=NULL) | |
Constructor. | |
& | _file2str ($file_name) |
Definition at line 158 of file class.ilBMFValue.php.
& ilBMFAttachment::_file2str | ( | $ | file_name | ) |
Definition at line 202 of file class.ilBMFValue.php.
References $file_name.
Referenced by ilBMFAttachment().
{ if (!is_readable($file_name)) { return PEAR::raiseError('File is not readable ' . $file_name); } if (!$fd = fopen($file_name, 'rb')) { return PEAR::raiseError('Could not open ' . $file_name); } $cont = fread($fd, filesize($file_name)); fclose($fd); return $cont; }
ilBMFAttachment::ilBMFAttachment | ( | $ | name = '' , |
|
$ | type = 'application/octet-stream' , |
|||
$ | filename, | |||
$ | file = NULL | |||
) |
Constructor.
string | name of the soap-value <value_name> | |
mixed | soap header value | |
string | namespace |
Definition at line 168 of file class.ilBMFValue.php.
References $file, ilBMFValue::$name, ilBMFValue::$type, _file2str(), and ilBMFValue::ilBMFValue().
{ global $SOAP_options; if (!isset($SOAP_options['Mime'])) { return PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements'); } parent::ilBMFValue($name, NULL, NULL); $filedata = ($file === NULL) ? $this->_file2str($filename) : $file; $filename = basename($filename); if (PEAR::isError($filedata)) { return $filedata; } $cid = md5(uniqid(time())); $this->attributes['href'] = 'cid:'.$cid; $this->options['attachment'] = array( 'body' => $filedata, 'disposition' => $filename, 'content_type' => $type, 'encoding' => 'base64', 'cid' => $cid ); }