0

Here's my file upload button:

<input type="file" name="image" required>
<button class="uk-button uk-button-default" type="button" tabindex="-1">Select Image</button>

And here's the code handling the file:

$largeimage = Image::make($_FILES['image']['tmp_name'])->fit(1060,707)->stream('jpg');
Storage::put('public/works/' . md5($image . microtime()) . '_large.jpg', $largeimage);
Topher
  • 141
  • 1
  • 2
  • 9

1 Answers1

0

You has to make a lot of changes. Its a terrible idea to store user info on public folder also Storage has as root folder the storage folder. You has to store it in storage folder

if($request->hasFile('image')){
    $image = $request->file('image');
    $largeimage = Image::make($image)->fit(1060,707)->encode('jpg');
    Storage::put('works/{md5(microtime())}.jpg', $largeimage);
}