Selaa lähdekoodia

added function to extract filename from an entity with error correction in
case the disposition isn't defined

stekkel 23 vuotta sitten
vanhempi
commit
6f4e609385
1 muutettua tiedostoa jossa 19 lisäystä ja 0 poistoa
  1. 19 0
      class/mime.class.php

+ 19 - 0
class/mime.class.php

@@ -667,6 +667,25 @@ class message
         $this->entities[] = $msg;
     }
 
+    function getFilename()
+    {
+	$filename = '';
+	if (is_object($this->header->disposition))
+	{
+	    $filename = $this->header->disposition->getproperty('filename');
+	    if (!$filename)
+	    {
+		$filename = $this->header->disposition->getproperty('name');
+	    }
+	}
+	if (!$filename)
+	{
+	    $filename = 'untitled-'.$this->entity_id;
+	}
+	return $filename;
+    }
+
+
     function addRFC822Header($read)
     {
 	$header = new rfc822_header();