Basically I want to upload an image and display it to an user, at the moment when image is selected, nothing happens I get no error mistakes or anything else and I am wondering what is going on.
Here is my code:
<form action="{{ action('BuilderController@testing') }}" role="form" method="POST">
<input class="form-control filestyle margin images" data-input="false" type="file" data-buttonText="Upload Logo" data-size="sm" data-badge="false" />
</form>
<div class="logo">
<img class="images" id="image" src="#" alt="Your Logo"/>
</div>
Controller:
public function testing() {
if(Input::file())
{
$image = Input::file('photo');
$filename = time() . '.' . $image->getClientOriginalExtension();
$path = public_path('images/' . $filename);
Image::make($image->getRealPath())->resize(200, 200)->save($path);
$user->image = $filename;
$user->save();
}
}
you must move image to folder storage and insert name in table, try to change action to route url exemple action="{{ url('add/image')}}"
routes exemple
controllers
form
you must using this code
enctype="multipart/form-data"
in html :add image using ajax without submit form auto submit when select image
routes
Controllers
View