Hello guys. I'm having trouble with Image Upload. I have a form with unique field, the image upload. When i click on the button i receive the message "Exception Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed". The funny thing is that the upload is working, and the image name is going to database
==== Controller ======
protected $layout = 'backend.templates.index';
public function store($id)
{
$object = PaginaInicial::find($id);
$imagem = Thumb::make('imagem', 280, 650, 'home/', false, '#FFFFFF', true);
if($imagem) {
File::delete('assets/images/home/'.$object->imagem);
$object->imagem = $imagem;
}
try {
$object->save();
Session::flash('sucesso', true);
Session::flash('mensagem', 'Imagem alterada com sucesso !');
return Redirect::route('painel.home.index');
} catch (\Exception $e) {
Session::flash('formulario', Input::all());
return Redirect::back()->withErrors(array('Erro ao editar imagem !'));
}
}
Observation: Thumb is another class created by me.In other projects she presented no problems.
Session::flash('formulario', Input::all());
change to:
Session::flash('formulario', Input::only('f1', 'f2')); //all except the file fields
Or just use return Redirect::back()->withErrors($errors)->withInput();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community