title: How to use PUT method in Laravel API with File Upload
body: <p>Having read this SO <a href="https://stackoverflow.com/questions/31089221/what-is-the-difference-between-put-post-and-patch">link</a>,</p>
  <p><code>PUT</code> is most-often utilized for update capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource.</p>
  <p><a href="https://stackoverflow.com/a/40711235/10907303">From this answer</a>,</p>
  <blockquote>
  <p>... we need to send <em><strong>all</strong></em> the parameters of the data again.</p>
  </blockquote>
  <p>In my controller, I have:</p>
  <pre><code>$student = Student::find($student_id);
  $student-&gt;username = $request-&gt;username;
  $student-&gt;email = $request-&gt;email;
  $student-&gt;password = $request-&gt;password;
  $path = $request-&gt;file('passport')-&gt;store('upload');
  $student-&gt;passport = $path;
  </code></pre>
  <p>I have once used this same code for <code>POST</code> method and it worked, but while using it for APIs, I used POSTMAN <code>form-data</code> and got <code>$request-&gt;all()</code> to be <code>null</code>. Some said I should use <code>x-www-form-urlencoded</code> but this does not allow files upload.</p>