/** * Constructor. * * @param string $name Name of the SOAP value <value_name> * @param string $type The attachment's MIME type. * @param string $filename The attachment's file name. Ignored if $file * is provide. * @param string $file The attachment data. */ function SOAP_Attachment($name = '', $type = 'application/octet-stream', $filename, $file = null) { parent::SOAP_Value($name, null, null); if (!isset($GLOBALS['SOAP_options']['Mime'])) { $this->options['attachment'] = PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements'); return; } $filedata = $file === null ? $this->_file2str($filename) : $file; $filename = basename($filename); if (PEAR::isError($filedata)) { $this->options['attachment'] = $filedata; return; } $cid = md5(uniqid(time())); $this->attributes['href'] = 'cid:' . $cid; $this->options['attachment'] = array('body' => $filedata, 'disposition' => $filename, 'content_type' => $type, 'encoding' => 'base64', 'cid' => $cid); }
/** * Constructor. * * @param string $name Name of the SOAP value <value_name> * @param string $type The attachment's MIME type. * @param string $filename The attachment's file name. Ignored if $file * is provide. * @param string $file The attachment data. * @param array $attributes Attributes. */ function SOAP_Attachment($name = '', $type = 'application/octet-stream', $filename, $file = null, $attributes = null) { parent::SOAP_Value($name, null, null); $filedata = $file === null ? $this->_file2str($filename) : $file; $filename = basename($filename); if (PEAR::isError($filedata)) { $this->options['attachment'] = $filedata; return; } $cid = md5(uniqid(time())); $this->attributes = $attributes; $this->attributes['href'] = 'cid:' . $cid; $this->options['attachment'] = array('body' => $filedata, 'disposition' => $filename, 'content_type' => $type, 'encoding' => 'base64', 'cid' => $cid); }