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

rameezisrar's avatar

FileNotFoundException($path);

I am trying to upload a file but i get this error:

vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
    /**
     * Tries to guess the mime type of the given file.
     *
     * The file is passed to each registered mime type guesser in reverse order
     * of their registration (last registered is queried first). Once a guesser
     * returns a value that is not NULL, this method terminates and returns the
     * value.
     *
     * @param string $path The path to the file
     *
     * @return string The mime type or NULL, if none could be guessed
     *
     * @throws \LogicException
     * @throws FileNotFoundException
     * @throws AccessDeniedException
     */
    public function guess($path)
    {
        if (!is_file($path)) {
            throw new FileNotFoundException($path);
        }
 
        if (!is_readable($path)) {
            throw new AccessDeniedException($path);
        }
 
        if (!$this->guessers) {
            $msg = 'Unable to guess the mime type as no guessers are available';
            if (!FileinfoMimeTypeGuesser::isSupported()) {
                $msg .= ' (Did you enable the php_fileinfo extension?)';
            }
            throw new \LogicException($msg);
        }
 
        foreach ($this->guessers as $guesser) {
            if (null !== $mimeType = $guesser->guess($path)) {
                return $mimeType;
            }
        }
    }
Arguments
"The file "" does not exist"

Under the POST Data, under Files

picture 
array:5 [▼
  "name" => "1.jpg"
  "type" => ""
  "tmp_name" => ""
  "error" => 6
  "size" => 0
]

Yet the same code just works fine on my local server, file is getting upload just fine but on the server it is giving me this error.

and my ProductController.php

public function update(Request $request, $id){
    product = Product::find($id);
            $product->name = $request->name;
            $product->type = $request->type;
            $product->category = $request->category;
            $product->plan_id = $request->plan_id;
            $product->price = $request->price;
            $product->picture = $request->file('picture')->store('products','public');
            $product->save();
}

It gives me the same error no matter the image size which is less than 2MB

0 likes
6 replies
ronmaxweb's avatar

Check to ensure your file permissions are correct.

ronmaxweb's avatar

@abudo yes, as in the storage folder specifically - it should be writable by your webserver.

1 like
rameezisrar's avatar
rameezisrar
OP
Best Answer
Level 18

tmp variable was empty in the php.ini file. I set the path and now the issue has been resolved

m_maj9's avatar

Hello @rameezisrar,

Please how did you handle the problem? I've been trying to find a solution for 2 days and I'm out of ideas now. Can you help me please ?

Please or to participate in this conversation.