Skip to content

getAttachments() save the file with 0 bytes size #188

Open
@n3omaster

Description

@n3omaster

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;
                }
            }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions