Welcome Guest, Not a member yet? Register   Sign In
Problem with move() and file exists (SOLVED)

Thank you for your reply.

For the following source code:

PHP Code:
    private function manageFiles($files$id$thumb false)

        $db              = \Config\Database::connect();
        $builderImages   $db->table('images');

        foreach ($files['theFile'] as $file) {
            if ($file->isValid() && !$file->hasMoved()) {

                $newName $file->getRandomName();

                $dataImages = [
                    'name' => $newName,
                    'galeries_id'  => $id,

                $image_path base_url() . '/uploads/' $newName;

                // just before the if statement.
                echo $image_path;

                if (!file_exists($image_path)) :
                    echo $image_path;
                    echo 'wrong_path';     // ==> Always !!

                if ($thumb) {

                    $image_dest '"' base_url() . '/uploads/330x200_' $newName '"';
                    $return $this->resize_img($image_path$image_dest33080'auto'true);
                    echo $return;

It give me the correct image path, this path points to an image, the browser finds it when I try to search for it with.
As the following screenshot shows:

[Image: kxn6.jpg]
In this topic, we can read the following: file exists doesn't work with http address


Messages In This Thread
RE: Problem with move() and file exists - by neoneeco - 11-20-2020, 04:12 AM

Theme © iAndrew 2016 - Forum software by © MyBB