Fetch icon indicating copy to clipboard operation
Fetch copied to clipboard

getAttachments() save the file with 0 bytes size

Open n3omaster opened this issue 8 years ago • 0 comments

I'm using this Class since two years ago. I want now save the attachments from the incoming email but it saves just the filename with cero data.

` $attachments = $message->getAttachments();

if ($attachments !== false) { foreach ($attachments as $attachment) {

                    var_dump($attachment);

                    $path = APPPATH . 'cache/uploads/' . $user->id;

                    if (!is_dir(APPPATH . 'cache/uploads/' . $user->id)) mkdir(APPPATH . 'cache/uploads/' . $user->id);

                    $name = $attachment->getFileName();

                    var_dump($name);

                    $data = $attachment->getData();

                    var_dump($data);

                    $mime = $attachment->getMimeType();
                    $size = $attachment->getSize();
                    $saved = $attachment->saveToDirectory($path);

                    //file_put_contents($path . "/asd.asd", $data);
                    $this->attach = true;
                }
            }`

n3omaster avatar Feb 24 '17 01:02 n3omaster