I wouldn't place logic relating to an HTTP request in your Model.
Beyond that, it looks like maybe you've already moved the file? Hard to know without seeing more.
Hello guys,
I was trying to do some upload tasks on an eloquent callback (tried with saved and saving) but I couldn't because somehow the file is deleted when the callback is executed.
I got :
File `/Applications/MAMP/tmp/php/phpUpH4Q5` does not exist
But it's the same callback. The way I'm doing that is like:
protected static function boot()
{
self::saving(function ($content) {
if (Input::file('image')) {
$content->clearMediaCollection();
$content->addMedia(Input::file('image'))
->toMediaCollection();
}
});
}
I think this is a pretty simple approach to get files being uploaded in an encapsulated, reusable and simple way.
Do you know how to solve that or maybe suggest me some others approach that work for you for handling file uploads for models ( Creation + Edit ).
Thank you!
Please or to participate in this conversation.