anyone having trouble with these files getting mangled in transport? i'm using the 
email class from renaghan's phpop. i'm wondering if the base64 encoding might be 
horking things?


  function formatAttachmentHeader($inFileLocation, $inNiceFileName){
    $outAttachmentHeader = "";
    //--get content type based on file extension
    $contentType = $this->getContentType($inNiceFileName);

    //--get contents of attachment file
    $aFile = fopen($inFileLocation,"rb");
    $aFileContents = fread($aFile, 2000000);
    fclose($aFile);

    //--if content type is TEXT the standard 7bit encoding
    if(ereg("text",$contentType)){
      //--format header
      $outAttachmentHeader .= "Content-Type: ".$contentType.";\n";
      $outAttachmentHeader .= ' name="'.basename($inNiceFileName).'"'."\n";
      $outAttachmentHeader .= "Content-Transfer-Encoding: 7bit\n";
      $outAttachmentHeader .= "Content-Disposition: inline;\n";  //--other: inline
      $outAttachmentHeader .= ' filename="'.basename($inNiceFileName).'"'."\n\n";
      $outAttachmentHeader .= $aFileContents."\n";

    }
    //--NON-TEXT use 64-bit encoding
    else{
      //--format header
      $outAttachmentHeader .= "Content-Type: ".$contentType.";\n";
      $outAttachmentHeader .= ' name="'.basename($inNiceFileName).'"'."\n";
      $outAttachmentHeader .= "Content-Transfer-Encoding: base64\n";
      $outAttachmentHeader .= "Content-Disposition: attachment;\n";  //--other: inline
      $outAttachmentHeader .= ' filename="'.basename($inNiceFileName).'"'."\n\n";
      $outAttachmentHeader .= chunk_split (base64_encode($aFileContents));
      $outAttachmentHeader .= "\n";
    }  
    return $outAttachmentHeader;
  }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to