Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bortz's avatar
Level 1

request->file('...')->store('...') returns false

Hello there, I noticed that the store method doesn't work lately (it was working before). With a code like this:

if ($request->hasFile("image")) {
    $request->file('image')->store('public/images')
}

the store method returns false and doesn't store the image. Why? The image folder exists and the permissions have been set.

EDIT: I'm using Laravel 9 and It's the same if I try with:

Storage::putFile('public/images', 'image');
0 likes
4 replies
bortz's avatar
Level 1

@Sinnbeck Wow, it turns out the folder had no write permissions. Huh. But it was working before I upgraded from 8.x to 9.x. Weird. I feel ashamed now. But thank you, sir.

andiparada's avatar

use this, hopefully useful

    $pdf_id = $request->file('pdf_id');
    $nama_pdf = $pdf_id->storeAs('pdf_id', uniqid().'.'.$pdf_id->extension(), ['disk'=>'public']);
1 like

Please or to participate in this conversation.