ardent icon indicating copy to clipboard operation
ardent copied to clipboard

issues with image validation in save

Open Faks opened this issue 10 years ago • 1 comments

after writing model i write rules following $rules = array( 'title' => 'required|', // password can only be alphanumeric and has to be greater than 3 characters 'image' => 'mimes:jpeg,bmp,png,gif|required', // make sure the email is an actual email 'short_text' => 'required|', // password can only be alphanumeric and has to be greater than 3 characters 'text' => 'required|' // make sure the email is an actual email ); after they are set i start with my controller i write following $input = array('title' => Input::get('title'), 'image' => Input::file('img'), 'short_text' => Input::get('short_text'), 'text' => Input::get('text')); #was using as fallback for input:all in hope it will work but it doesn't. $destinationPath = 'img/'; // upload path $fileName = Input::file('img')->getClientOriginalName(); // Input::file('img')->move($destinationPath, $fileName); // uploading file to given path #storing to database special update for code universal for multilingual $news = new News(Input::all()); if($news->save()) { Redirect::back()->withMessage('Ok','added news'); } else { Redirect::back()->withErrors( $news->errors() ); }

then in form i select image for upload and it gets stuck with endless loop image required even if take file with different mime type it simply doesn't recognize it and persists on image required error.

Faks avatar Mar 07 '15 15:03 Faks

+1

hjonac avatar Apr 22 '15 18:04 hjonac