Horde_Mime_Part::setName PHP Method

setName() public method

Set the name of this part.
public setName ( string $name )
$name string The name to set.
    public function setName($name)
    {
        $this->setDispositionParameter('filename', $name);
        $this->setContentTypeParameter('name', $name);
    }

Usage Example

Example #1
0
 /**
  * If this MIME part can contain embedded MIME part(s), and those part(s)
  * exist, return a representation of that data.
  *
  * @return mixed  A Horde_Mime_Part object representing the embedded data.
  *                Returns null if no embedded MIME part(s) exist.
  */
 protected function _getEmbeddedMimeParts()
 {
     /* Get the data from the attachment. */
     try {
         if (!($tnef = $this->getConfigParam('tnef'))) {
             $tnef = Horde_Compress::factory('Tnef');
             $this->setConfigParam('tnef', $tnef);
         }
         $tnefData = $tnef->decompress($this->_mimepart->getContents());
     } catch (Horde_Compress_Exception $e) {
         $tnefData = array();
     }
     if (!count($tnefData)) {
         return null;
     }
     $mixed = new Horde_Mime_Part();
     $mixed->setType('multipart/mixed');
     reset($tnefData);
     while (list(, $data) = each($tnefData)) {
         $temp_part = new Horde_Mime_Part();
         $temp_part->setName($data['name']);
         $temp_part->setDescription($data['name']);
         $temp_part->setContents($data['stream']);
         /* Short-circuit MIME-type guessing for winmail.dat parts;
          * we're showing enough entries for them already. */
         $type = $data['type'] . '/' . $data['subtype'];
         if (in_array($type, array('application/octet-stream', 'application/base64'))) {
             $type = Horde_Mime_Magic::filenameToMIME($data['name']);
         }
         $temp_part->setType($type);
         $mixed->addPart($temp_part);
     }
     return $mixed;
 }
All Usage Examples Of Horde_Mime_Part::setName