• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
finfo_file(): Empty filename or path in CodeIgniter 4.0.4

#1
I'm having this error when I try to upload 1 image in CodeIgniter 4.0.4.

[Image: xp1jT.png]


SYSTEMPATH/Files/File.php at line 153
Code:
152         $finfo    = finfo_open(FILEINFO_MIME_TYPE);
153         $mimeType = finfo_file($finfo, $this->getRealPath());
154         finfo_close($finfo);
155         return $mimeType;


This is my code:
Code:
if ($img = $this->request->getFile('foto')) {
  if ($img->isValid() && !$img->hasMoved()) {
    $img->move('img/uploads/user');
    $namaFoto = $img->getName();
  }
} else {
  $namaFoto = 'user.png';
}


But when I try to upload multiple images, it works fine. This is the code to upload multiple images:
Code:
$fileFoto = $this->request->getFileMultiple('foto');

foreach ($fileFoto as $foto) {
    if ($foto->isValid() && !$foto->hasMoved()) {
      $foto->move('img/uploads/barang');
      $this->fotoModel->save([
        'slug' => $slug,
        'foto' => $foto->getName()
      ]);
    }
}


Is there a problem when CodeIgniter upgrade to version 4.0.4 because I did not experience problems when uploading a single file in version 4.0.3.
Reply


Messages In This Thread
finfo_file(): Empty filename or path in CodeIgniter 4.0.4 - by anggakswr - 07-26-2020, 05:27 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.