var_dump(explode(".", $data['image']));
$file[0] = explode(".", $data['image']);
echo $file[0];

The result:

array(2) { [0]=> string(6) "image2" [1]=> string(3) "jpg" } Array

I am trying to store "image2" in $file, how? (exclude the jpg)

You will be able to use function pathinfo(), If want get filename without it extension.
For example:

echo pathinfo("test.jpeg", PATHINFO_FILENAME);// show test
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.