Skip to content

FileNotFoundException when uploading PDF #95

Open

Description

@MatthewRuddy

Hey. Been using this package for a while now, working well until recently. For a particular model I'm using a PDF as an attachment.

Works fine with image file types (jpg, png, etc). But PDF's throw the error below. Getting this same error both locally and on my server hosted with Digital Ocean managed by Laravel Forge.

screen shot 2015-12-11 at 02 38 20

Activity

  1. tabennett commented on Jan 30, 2016

    @tabennett
    Contributor

    I've never had any issues uploading pdf's with this package. Are you defining styles for the attachment that you're uploading the PDF with?

  2. NightZpy commented on Jan 31, 2016

    @NightZpy

    Maybe 'files' => true in the form definition?

  3. gravitano commented on Jun 2, 2016

    @gravitano

    Hello, I have some problem regarding this issue. Any update for this?

  4. fukuyama-ej commented on Jul 10, 2017

    @fukuyama-ej

    I have some problem too. this problem was occured when hasAttachedFile have styles options

    this is not good

        $this->hasAttachedFile('pdf', [
            'styles' => [
                'thumbnail' => [
                    'dimensions' => '300x300#',
                ],
                'icon' => [
                    'dimensions' => '64x64#',
                ],
            ]
        ]);
    

    it works fine

        $this->hasAttachedFile('pdf', [
            'styles' => []
        ]);
    

    at codesleeve/stapler/src/Attachment.php , protected function flushWrites() {}

    $this->move($file, $filePath); causes this problem because if non image file of $file var is just, temporaly uploaded file of php system . so, only just 1time works fine. but next loop, this tmp file was gone by $this->move() .

    I think need skipping for this loop if non image given and style dose not original like this

    protected function flushWrites()
    {
        foreach ($this->queuedForWrite as $style) {
            if ($style->name != 'original' && !$this->uploadedFile->isImage()) {
                continue;
            }
    

    Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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