-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading no selected picture on product edit page generates exception #14
Comments
Do not know if this helps spatie/laravel-medialibrary#646 |
Vanilo v0.4 was released yesterday. Please use a fresh new install and check if that works. |
Hmm ok.., thanks for the report, I'll look into it shortly. |
I am just having a look around the 0.4 now and the upload of files when creating products works. It it just the edit exception. |
Do you mean that the only problem is when you submit Images on product edit form without files selected with the green arrow? |
Yes |
I have changed public function store(Request $request)
{
if(!$request->has('images')){
flash()->error(__('No image supplied, image is required!'));
return redirect()->back();
}
// Laravel Black Magic
$model = app(concord()->short($request->get('forType')))->find($request->get('forId'));
$model->addMultipleMediaFromRequest(['images'])->each(function ($fileAdder) {
$fileAdder->toMediaCollection();
});
flash()->success(__('Images have been added successfully!'));
return redirect()->back();
} and the exception is not triggered |
Ok, I'll add that validation to the framework |
It's been released in framework v0.4.1. Thanks again for the report + the suggestion. |
When editing product in dashboard and I do not select any picture and press upload exception
Spatie\MediaLibrary\Exceptions\FileCannotBeAdded\RequestDoesNotHaveFile appears. With message "The current request does not have a file in a key named
images
"I am still using the demo from 2 weeks time, if it was fixed please close the issue.
The text was updated successfully, but these errors were encountered: