Support the ongoing development of Laravel.io →
posted 10 years ago
Input

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.

Last updated 2 years ago.
0
Session::flash('formulario', Input::all());

change to:

Session::flash('formulario', Input::only('f1', 'f2')); //all except the file fields
Last updated 2 years ago.
0

or even better

Input::flash()
Last updated 2 years ago.
0

Or just use return Redirect::back()->withErrors($errors)->withInput();

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

allanbobs allanbobs Joined 26 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.