title: Storing File to public storage of Laravel (ReactJS & Laravel)
body: <p>I start doing CMS using Laravel and ReactJS. this is my first time to use this. I have problem regarding storing file to the public storage of laravel. I know this is duplicate question. but i need to solve this. Thanks.</p>
  
  <ol>
  <li><p>I start testing inserting content w/ out file. the output is (Success)</p></li>
  <li><p><strong>This is my problem when i start doing storing file to public storage it gives me error.</strong></p></li>
  </ol>
  
  <p><strong>My input file:</strong></p>
  
  <pre><code>&lt;input type="file" name="image" class="form-control-file" accept="image/x-png,image/gif,image/jpeg" id="exampleFormControlFile1"&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3Q5q9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Q5q9.jpg" alt="Image error"></a></p>
  
  <p>This is my function in my Controller:</p>
  
  <pre><code>public function save_home_content(Request $request)
  {
  
      $content_page = $request-&gt;get('pageValue');
      $content_section = $request-&gt;get('sectionValue');
      $content_title = $request-&gt;get('titleValue');
      $content = $request-&gt;get('textValue');
      $content_link = $request-&gt;get('linkValue');
  
      $now = new DateTime();
  
      if($request-&gt;get('imageValue'))
      {
          $file = $request-&gt;get('imageValue');
          $content_type = $request-&gt;get('typeValue');
  
  
          $filename =  $request-&gt;file-&gt;getClientOriginalName();
          return $request-&gt;storeAs('public',$filename);
  
         try {
  
         }
         catch(\Exception $e)
         {
          return $e-&gt;getMessage();
         }
      }
  }
  </code></pre>