I have a file input element on my laravel and it is returning a null value. I have tried var_dump and dd() to see the values returned on form post and it returns null. I have also read similar questions and tried to apply several of the suggested solutions to my problem yet i have had no luck finding the solution.
I have even checked the max upload size for my wamp server and the file size of the images i am trying to upload are all in kilobytes and no where close to even 1mb.
what could i be doing wrong?
this is my view
<div class="container">
<a href=""> Edit This Page </a>
{{ Form::open( array('route' => 'postSiteTest', 'files' => true)) }}
{{Form::file('testLink')}}
{{ Form::token() }}
<input type="submit" value="Save Changes" class="btn btn-primary btn-lg">
{{ Form::close() }}
</div>
and this is my controller
public function postSiteTest()
{
$file = Input::file('testLink');
var_dump($file);
$test = new FacilitiesPg();
$file1 = Input::file('testlink');
$fileName1 = $file1->getClientOriginalName();
$test->libImgLink = $fileName1;
if($test->save())
{
return 'img name saved';
}
}
i think this line:
$file1 = Input::file('testlink');
should be change to:
$file1 = Input::file('testLink');
and also you can use this code for submit button instead for HTML code:
{{Form::submit('Save Changes' , array('class' => 'btn btn-lg btn-info btn-block'))}}
After spending many hours trying to fix this error, I discovered that the problem was from the value of "post_max_size" property in the php.ini file. I was uploading files that exceeded the amount specified in the php.ini file during file post. Increasing the "post_max_size" solved this problem. I hope it helps somebody.