Welcome Guest, Not a member yet? Register   Sign In
File upload work on php 7.2, but not on 7.4.14
#1

(This post was last modified: 01-20-2021, 02:48 AM by t_5810.)

I have an Codeigniter app, which works like a charm on PHP 7.2
After moving on PHP 7.4.14, I get an error "No input file specified." Search on Google suggested that I should add a question mark in my .htaccess file
Code:
RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]
to resolve the issue. And that was the only change that I did. However, I notice that since the upgrade, my code for uploading images does not work (application wide).
I have options to upload images on many pages, and they all works if I switch back to PHP 7.2, but does not work on PHP 7.4.14
The error that I get is:
finfo_file(): Empty filename or path
My validation code is the following:


Code:
// Thumbnail image is not required, so validation is optional
$webpageThumbnailImage = $this->request->getFile('webpageThumbnailImage');
    if ($webpageThumbnailImage != "") {
        if (!($this->validate([
            'webpageThumbnailImage'            => [
            'uploaded[webpageThumbnailImage]',
            'mime_in[webpageThumbnailImage,image/jpg,image/jpeg,image/gif,image/png,image/bmp]',
                        'max_size[webpageThumbnailImage,4096]',
            ],
        ]))) {
        // Validation has failed, redirect the user back
        return redirect()->to(base_url() . '/Backend/Webpage/edit_record/' . $this->request->getPost('webpageID'))->withInput();
    }
    if (!$webpageThumbnailImage->isValid()) {
        throw new RuntimeException($webpageThumbnailImage->getErrorString() . '(' . $webpageThumbnailImage->getError() . ')');
    }
    $newName = $webpageThumbnailImage->getRandomName();
    $webpageThumbnailImage->move('./backOffice/backOfficeImages/', $newName);
} else {
    $newName = NULL;
}

Questions is: Why this code works on PHP 7.2 and does not work on PHP 7.4.14?
Reply


Messages In This Thread
File upload work on php 7.2, but not on 7.4.14 - by t_5810 - 01-20-2021, 02:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB