How to upload image in laravel 8 ?

Report
Question
779 views

Please explain why do you think this question should be reported?

Report Cancel
<pre>
$request-&gt;validate([
&#39;image&#39; =&gt; &#39;required|image|mimes:jpeg,png,jpg,gif,svg|max:2048&#39;,
]); // Validate image type

<p>$imageName = time().&#39;.&#39;.$request-&gt;image-&gt;extension(); // Create image name&nbsp;</p>

<p>$request-&gt;image-&gt;move(public_path(&#39;images&#39;), $imageName); // Move image into folder</p>
</pre>

Thread Reply

Leave an comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>