Upload file extension being stripped from .jpeg files
Site is running 1.5.7b and some products have text/file attributes for customers to upload images. On the product page, the files is selected from the desktop and when the product is added to the cart it displays the full file name and extension. On checkout success, the order is written to the orders.products_attributes table, the products_options_values field is written as file-id. (313. instead of 313.jpeg for example) when the uploaded file extension is .jpeg. The file is uploaded in the images/upload folder with the correct name. If the file extension is .jpg it works as expected. I'm struggling to find the cause of this. Can anybody point me in the right direction?
Re: Upload file extension being stripped from .jpeg files
Compare your copy of includes/classes/upload.php to a fresh download from 1.5.7b (your version).
Re: Upload file extension being stripped from .jpeg files
Quote:
Originally Posted by
swguy
Compare your copy of includes/classes/upload.php to a fresh download from 1.5.7b (your version).
They compared fine
Re: Upload file extension being stripped from .jpeg files
I should also add that this code appears to relate to the actual upload and not writing the uploaded file name to the database. No errors are received that it is an invalid file type and the file is written with the correct extension.
Re: Upload file extension being stripped from .jpeg files
OK, how about includes/classes/order.php - any changes?
Re: Upload file extension being stripped from .jpeg files
The only change is to the section building the confirmation email at around line 1018
PHP Code:
$this->products_ordered_html .=
'<tr>' . "\n" .
//RB mod - Product Image
'<td class="product-details" align="left" valign="top" width="30">' . zen_get_products_image($this->products[$i]['id']) . '</td>' . "\n" .
//RB mod - Product Image
Re: Upload file extension being stripped from .jpeg files
Out of curiosity, does the same issue occur with the image file extension of tiff as compared to tif? Both of these file extensions are recognized in a default install for upload extensions. May help identify a factor contributing to stripping jpeg from the information as compared to tiff.
Re: Upload file extension being stripped from .jpeg files
Quote:
Originally Posted by
mc12345678
Out of curiosity, does the same issue occur with the image file extension of tiff as compared to tif? Both of these file extensions are recognized in a default install for upload extensions. May help identify a factor contributing to stripping jpeg from the information as compared to tiff.
I didn't want to do this on the live site since it requires putting completed orders in. I happened to have a clone of the site that is being used to build a new site. It has a fresh database but the files are identical with the exception of the config files. I added a product to the database with a single attribute type file. Interestingly I found that it works correctly. I'm going to do a full comparison of the files from both sites. Hopefully, I'll find some files that are different. If not that kind of points to a database issue. I don't see any structure differences in the orders_products_attributes table though.
Re: Upload file extension being stripped from .jpeg files
Tested in unmodified 1.5.7c with test product 34; used a file with extension "jpeg" as the front image, completed the order, orders_products_attributes.products_options_values field looks correct.
Re: Upload file extension being stripped from .jpeg files
Quote:
Originally Posted by
swguy
Tested in unmodified 1.5.7c with test product 34; used a file with extension "jpeg" as the front image, completed the order, orders_products_attributes.products_options_value field looks correct.
That's similar to what I'm seeing on the clone. The files from both compared as expected. I exported the table, dropped the table on the clone, and imported and emptied to the clone db. Still worked fine. I'm going to import the entire database and see if that causes the problem. Narrowing things down.