@Cronix any idea about this?
May 14, 2018
6
Level 18
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
Level 18
tmp variable was empty in the php.ini file. I set the path and now the issue has been resolved
Please or to participate in this conversation.