$input = Input::all();
$input['resim'] = Input::file('resim')->getClientOriginalName();
$rules = array(
'resim' => 'required|max:3000|image|mimes:jpg,gif,png',
);
$validation = Validator::make($input, $rules);
if($validation->fails())
{
return View::make('theme-admin.slider_add')
->nest('message_area', 'theme-admin.error', array('message' => $validation->messages()->first()));
}
...
The issue is, Input::file('resim')->getClientOriginalName();
throw exception when the image is not uploaded. (e.g when I directly click on submit button on HTML form)
However, required|max:3000|image|mimes:jpg,gif,png
this rule does not work if I erase that line. Whether if I upload a valid image or not, it doesn't pass mimes:jpg,gif,png
control.
How can I do this without relying on Input::file('resim')->getClientOriginalName();
? I want required
control to handle what's necessary.