What is the File Upload class in CodeIgniter 4?

Why Interviewers Ask This

This is a classic screening question for CodeIgniter roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

CodeIgniter 4 handles file uploads through the Files abstraction in the Request object. Get uploaded file: $file = $this->request->getFile("avatar"). Validate: if (!$file->isValid() || $file->hasMoved()) { return; }. Move to destination: $file->move(WRITEPATH . "uploads", $file->getRandomName()). File information: $file->getName(), $file->getSize(), $file->getMimeType(), $file->guessExtension(). Security: use guessExtension() instead of trusting the client-provided extension, validate MIME type, check file size, and use getRandomName() to generate safe filenames. For multiple file uploads: $files = $this->request->getFiles(). CI4's file handling is simpler and cleaner than CI3's Upload library.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last CodeIgniter project, I used this when...' immediately makes your answer more credible and memorable.