Last active
March 8, 2017 07:20
-
-
Save segun6060/b1ca5847298bcfbf0fc4e32f7c425aa8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function store(Request $request) | |
{ | |
$image = new Image; | |
$image->user_id = Auth::user()->id; | |
if($request->hasFile('imageproof')) { | |
$proof = $request->file('imageproof'); | |
$filename = time().'.'.$proof->getClientOriginalExtension(); | |
$location = public_path('images/',$filename ); | |
Image::make($proof)->resize(800, 400)->save($location); | |
$image->filePath=$filename; | |
} else { | |
return 'Image Proof not found'; | |
} | |
$image->save(); | |
return 'Image Uploaded Successfully'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/store" enctype="multipart/form-data" method="post"> | |
<div class="form-group"> | |
<h4 class="help-block">Uplaod proof of payment after paying.</h4> | |
<label for="exampleInputFile">File input</label> | |
<input type="file" name="imageproof" id="exampleInputFile"> | |
{{csrf_field()}} | |
</div> | |
<button type="submit" class="btn btn-default">Upload</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::post('store', 'HomeController@store' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment