Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default 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?

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default 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).
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Upload file extension being stripped from .jpeg files

    Quote Originally Posted by swguy View Post
    Compare your copy of includes/classes/upload.php to a fresh download from 1.5.7b (your version).
    They compared fine

  4. #4
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default 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.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: Upload file extension being stripped from .jpeg files

    OK, how about includes/classes/order.php - any changes?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #6
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default 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 

  7. #7
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default 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.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Upload file extension being stripped from .jpeg files

    Quote Originally Posted by mc12345678 View Post
    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.
    Last edited by badarac; 9 Jun 2021 at 01:42 PM.

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default 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.
    Last edited by swguy; 9 Jun 2021 at 03:49 PM.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  10. #10
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Upload file extension being stripped from .jpeg files

    Quote Originally Posted by swguy View Post
    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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v156 GET query string being stripped from url
    By badarac in forum General Questions
    Replies: 33
    Last Post: 20 Jan 2020, 10:34 PM
  2. v154 File Upload - Want users to be able to select Multiple Files
    By aws702 in forum General Questions
    Replies: 1
    Last Post: 28 Feb 2017, 07:57 PM
  3. File upload capability (1GB files)
    By hllight in forum General Questions
    Replies: 14
    Last Post: 1 Jun 2009, 03:11 PM
  4. My customers cannot upload files having uppercase letters in filename extension
    By Bostitch in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 17 Jun 2008, 03:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR