I'm trying to upload images to laravel and I'm having some trouble :S
My view:
<form role="form" method="post" action="{{url('admin/test')}}" id="formm" >
<input type="file" placeholder="browse" id="imagen_item" name="imagen_item" accept="image/*"/>
<input type="submit" style="font-size: 20px" class="btn btn-primary" value="Guardar">
</form>
My routes.php
Route::post('admin/test','AdminController@test');
My Controller
public function test()
{
$file = Input::file('imagen_item');
var_dump($file);
$destinationPath = 'uploads/';
if(is_object($file))
{
$filename = $file->getClientOriginalName();
$upload_success = Input::file('imagen')->move($destinationPath, $filename);
if( $upload_success ) {
echo 'save this url: '.$filename." in the DB";
}
}
}
And what I get after submitting the form:
null
A
A.A
So obvously the problem is the I'm not thetting the image from the input form.. but why?? I have the same name... Thank you!