title: Laravel Image Upload not saving to public folder
body: <p>I am struggling with this image upload system.
  It is supposed to upload an image that will be attached to a post (each post has 1 image).</p>
  
  <p>Everything seems to be working fine, the problem is that when I check the database for the image path, I see a path to a random temporary file and the image doesn't even get uploaded to the right folder inside the app public folder.</p>
  
  <p>Check the logic below:</p>
  
  <p>PostController.php</p>
  
  <pre><code>public function store(Request $request)
  {
      $post = new Post;
  
      $request-&gt;validate([
          'title' =&gt; 'required',
          'description' =&gt; 'required',
          'slug' =&gt; 'required',
          'message' =&gt; 'required',
          'user' =&gt; 'required',
          'post_image' =&gt; 'image|mimes:jpeg,png,jpg,gif|max:2048'
          ]);
  
          if ($request-&gt;has('post_image')) {
              $image = $request-&gt;file('post_image');
              $name = Str::slug($request-&gt;input('title')).'_'.time();
              $folder = '/uploads/images/';
              $filePath = $folder . $name. '.' . $image-&gt;getClientOriginalExtension();
              $this-&gt;uploadOne($image, $folder, 'public', $name);
              $post-&gt;post_image = Storage::url($filePath);;
          }
  
      Post::create($request-&gt;all());
  
      return \Redirect::to('admin')-&gt;with('success','Great! Post created successfully.');
  }
  </code></pre>
  
  <p>UploadTrait.php</p>
  
  <pre><code>trait UploadTrait
  {
      public function uploadOne(UploadedFile $uploadedFile, $folder = null, $disk = 'public', $filename = null)
      {
          $name = !is_null($filename) ? $filename : Str::random(25);
  
          $file = $uploadedFile-&gt;storeAs($folder, $name.'.'.$uploadedFile-&gt;getClientOriginalExtension(), $disk);
  
          return $file;
      }
  }
  </code></pre>
  
  <p>Post.php (model)</p>
  
  <pre><code>    class Post extends Model
  {
      protected $fillable = [
          'title',
          'description',
          'slug',
          'message',
          'user',
          'post_image'
         ];
  
  
      public function getImageAttribute(){
          return $this-&gt;post_image;
      }
  
  }
  </code></pre>
  
  <p>Create.blade.php</p>
  
  <pre><code>&lt;form action="{{ route('blog.store') }}" method="POST" name="add_post" role="form" enctype="multipart/form-data"&gt;
  {{ csrf_field() }}
  
  &lt;h1&gt;New Post&lt;/h1&gt;
  &lt;div role="separator" class="dropdown-divider"&gt;&lt;/div&gt; 
  
  &lt;div class="form-row"&gt;
      &lt;div class="form-group col-12 col-md-6"&gt;
        &lt;label for="title"&gt;Post Title&lt;/label&gt;
        &lt;input type="text" autocomplete="off" class="form-control" id="title" name="title" placeholder="Your post title" required&gt;
        &lt;span class="text-danger"&gt;{{ $errors-&gt;first('title') }}&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group col-12 col-md-6"&gt;
          &lt;label for="slug"&gt;Slug&lt;/label&gt;
        &lt;input type="text" autocomplete="off" class="form-control" id="slug" name="slug" placeholder="Write post slug" required&gt;
        &lt;span class="text-danger"&gt;{{ $errors-&gt;first('slug') }}&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="form-row"&gt;
      &lt;div class="form-group col-12 col-md-12"&gt;
          &lt;label for="description"&gt;Post Description&lt;/label&gt;
        &lt;textarea class="form-control" id="description" name="description" placeholder="Enter a small description for your post" required&gt;&lt;/textarea&gt;
        &lt;span class="text-danger"&gt;{{ $errors-&gt;first('description') }}&lt;/span&gt;
      &lt;/div&gt;
  
  
  &lt;/div&gt;
  
  
      &lt;div class="badge badge-warning badge-pill"&gt;Message&lt;/div&gt;
      &lt;div role="separator" class="dropdown-divider"&gt;&lt;/div&gt;
  
   &lt;div class="form-row"&gt;
      &lt;div class="form-group col-md-12"&gt;
          &lt;textarea class="form-control" col="4" id="message" name="message"&gt;&lt;/textarea&gt;
          &lt;span class="text-danger"&gt;{{ $errors-&gt;first('message') }}&lt;/span&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;input type="hidden" value="{{ Auth::user()-&gt;name }}" name="user"&gt;
  
  &lt;input id="post_image" type="file" class="form-control" name="post_image"&gt;
  
  
  
    &lt;button type="submit" class="btn btn-warning btn-block"&gt;Create Post&lt;/button&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Thank you for your help!</p>
  
  <p>Regards,
  Tiago</p>