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

developer alamin's avatar

When i Upload file show this error "The "" file does not exist or is not readable."

The "" file does not exist or is not readable.

0 likes
10 replies
LaryAI's avatar
Level 58

This error message usually occurs when the file path is incorrect or the file permissions are not set correctly. Here are a few things you can try:

  1. Check the file path: Make sure that the file path you are using is correct. Double-check the spelling and make sure that the file exists in the specified location.

  2. Check file permissions: Make sure that the file has the correct permissions set. The file should be readable by the web server user. You can set the file permissions using the chmod command.

  3. Check upload directory permissions: Make sure that the directory where you are uploading the file has the correct permissions set. The directory should be writable by the web server user. You can set the directory permissions using the chmod command.

Here's an example of how to set the file and directory permissions using the chmod command:

chmod 644 /path/to/file
chmod 755 /path/to/directory

If you're still having issues, try checking the PHP error logs for more information about the error.

developer alamin's avatar

@Snapey public function update(SiteInfoRequest $request, SiteInfo $site_info) { $data = $request->all();

    $site_info->tagline          = $data['tagline'];
    $site_info->title            = $data['title'];
    $site_info->meta_keywords    = $data['meta_keywords'];
    $site_info->meta_description = $data['meta_description'];
    $site_info->openai_api_key   = $data['openai_api_key'];

    if ($request->file('logo')) {
        if ($site_info->logo) {
            Storage::delete($site_info->logo);
        }
        $site_info->logo = Storage::putFile('siteInfo', $request->file('logo'));
    }
    $site_info->save();

    Toastr::success('SiteInfo successfully updated :)', 'Success');
    return redirect()->route('site-info.index');
}
Snapey's avatar

@developer alamin suggested change;

        if (!empty($site_info->logo)) {
            Storage::delete($site_info->logo);
        }

You could also wrap the delete in a try-catch block

For the future, please make sure you post the complete error message including which line in your code errors. I'm assuming its the file delete that is failing.

developer alamin's avatar

@Snapey Same code works my another controller. In this error i search in google but can't properly ans . I think code is okay . when i upload IMG-2232333.jpg extension file show this error. but another dsfsdflsf.jpg file upload properly.

andresvo's avatar

I had the same issue. The cause was that the file size was bigger than the maximum upload size set in php.ini.

Go3shom's avatar

@developer alamin

Assuming that you are on windows machine and using XAMPP as a local server.

  1. Go to C:/xampp/php folder.
  2. Open php.ini file.
  3. Search for File Uploads section.
  4. Increase the upload_max_filesize.
  5. and finally restart Apache server in xampp.
  6. Try to upload your file(s) again.
dmytro23's avatar

I had a problem downloading larger files(php-8.3). It helped - sudo systemctl stop php-fpm / sudo systemctl start php8.3-fpm

Please or to participate in this conversation.