I am having an issue using the dashboard to create a new product. When I try to upload the image files for the product, it does upload both files (main & thumbnail) to the images folder. My scenario is I have a producted named 'toy3', I have a main image named 'toy3-main.jpg' (200 x 200) which has no problem uploading and keeping the name. I have a thumbnail image named 'toy3-thumb.jpg' (30 x 30) which upon upload changes the name to 'toy3-main.jpg.jpg' (no typo). When I reverse the order in the 'mproducts.php' model -> function addProduct (), it does the same to the main image and keeps the thumbnail name correct. It seems that the script is having an issue with the $thumb['file_name'] array and using the same name as in the previous $image['file_name'] array. Here it is as I've got it and how it is stated in the textbook (pg 172) after configuring and loading the upload library (note- The only minor change is I have taken off the leading / to the images path as I already have it configured in the base_url() of the config file): I have highlighted red what I think to be the issue.
$image = $this->upload->data();
$data['image'] = "http://p2p.wrox.com/images/".$image['file_name'];
$thumb = $this->upload->data();
$data['thumbnail'] = "http://p2p.wrox.com/images/".$thumb['file_name'];
Any answers to why it may be doing this? It is still working and it inserts the path to the thumbnail in the database to the newly named image file, but of course it messes with my naming convention for the other images & thumbnails already in the images folder.
Just a note: I forsee I will probably have the same issue on the updateProduct() function.