Support the ongoing development of Laravel.io →
Requests Input
Last updated 2 years ago.
0

re arrange the code like this

    // move to media storage
    $dest = 'images/tmp';

    // add record
    $media = Media::create(array(
        'name' => $file->getClientOriginalName(),
        'location' => $dest,
        'mime' => $file->getMimeType(),
        'size' => $file->getSize()
    ));

    $file->move($dest);
Last updated 2 years ago.
0

Well, that worked, but I have no idea why...

Last updated 2 years ago.
0

well you have found a bug on Symfony\Component\HttpFoundation\File class implementation

see, this class extends the native class SplFileInfo, when you instantiate this class, the instance is associate to a file path location, so if you move this file, SplFileInfo will still pointing to the old file path, so any next method call will fail

still, the solution of this is error is very complicated because you need to replace the current instance, $this, to a new one

Last updated 2 years ago.
0

Probably doing this would solve that too:

$file = $file->move($dest);
Last updated 2 years ago.
0

Interesting. Thanks for the info guys.

Last updated 2 years ago.
0

It could also be related to the file size.

https://github.com/1up-lab/OneupUploaderBundle/issues/44

I personally solved the same issue increasing the post_max_size and upload_max_size values to 32M.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.