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

mshafnas's avatar

Image retrieving

Hi developers, I can upload the files into storage folder without any issue in lumen but when I try to retrieve it I am getting an error message saying The requested resource /storage/profile_images/1629284722_1.jpg was not found on this server.

profile = $request->file('profile'); //Get file name with extension $filen_name_with_ext = $profile->getClientOriginalName();

            // Get only file name
            $file_name = pathinfo($filen_name_with_ext, PATHINFO_FILENAME);
            // Get only the extension
            $file_ext = $profile->getClientOriginalExtension();

            $file_name_to_store = time().'_'.$request->staff_id.'.'.$file_ext;

            $file_directory = storage_path().'/'.'profile_images';

            if (!file_exists($file_directory)) {
                // directory not exists
                if (File::makeDirectory($file_directory, 0777, true)) {
                    $profile->move($file_directory .'/', $file_name_to_store);
                }
                else{
                    return response()->json(['error' => true, 'data' => 'Unable to upload profile picture!'],500);
                }

            }
            else{
                $profile->move($file_directory .'/', $file_name_to_store);
            }

This is my coding. can anyone help me to retrieve the image using the url of web because I need to render the image in another project.

0 likes
3 replies
mshafnas's avatar

the storage link command is not available in lumen. when I run getting There are no commands defined in the "storage" namespace

mshafnas's avatar
mshafnas
OP
Best Answer
Level 1

Solved. I had to run this ln -s ../storage public in terminal

Please or to participate in this conversation.