Welcome Guest, Not a member yet? Register   Sign In
Upload PDF file (not required)
#2

First, you need to check if the file was submitted before you do any validation. 

You can do so by using the [code]getFiles()[\code] function provided by CI. See documentation: Working with Uploaded Files — CodeIgniter 4.0.4 documentation

So your code would look like this:
PHP Code:
$uploaded_file $this->request->getFiles('file');

if ( !empty(
$uploaded_file) ) 
{
    // File was uploaded, run other validation here
}
else 
{
    // No file was uploaded

Reply


Messages In This Thread
Upload PDF file (not required) - by xibnoe - 11-22-2020, 07:06 PM
RE: Upload PDF file (not required) - by sammyskills - 11-23-2020, 05:09 AM
RE: Upload PDF file (not required) - by InsiteFX - 11-25-2020, 03:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB