Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Mar 2011
    Posts
    33
    Plugin Contributions
    0

    Default File Upload Attribute not working in v1.5.6c

    Hello,

    I have just fresh installed Zencart v1.5.6c with demo products data.

    NO PLUGINS INSTALLED.

    PHP Version: 7.1.30

    Files i tried are jpg, jpeg, zip extensions which are supported in configuration

    I assigned file upload attribute to one product
    http://bambhaniya.website/index.php?...&products_id=1

    When i upload any file it says

    Error: File type not allowed. .0

    SCREENSHOT ATTACHED.
    Name:  error screeshot.jpg
Views: 767
Size:  37.7 KB

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: File Upload Attribute not working in v1.5.6c

    That's an over-zealous sanitization of the Maximum Values configuration-group from this Zen Cart change.

    The issue is that there's one configuration setting (UPLOAD_FILENAME_EXTENSIONS) that's not an integer, which is what you've identified. To correct, you'll need to edit /includes/init_includes/init_db_config_read.php, changing
    Code:
    while (!$configuration->EOF) {
      /**
     * dynamic define based on info read from DB
     */
      if ($configuration->fields['configuration_group_id'] == 2 || 
        $configuration->fields['configuration_group_id'] == 3) { 
        define(strtoupper($configuration->fields['cfgkey']), (int)$configuration->fields['cfgvalue']);
      } else { 
        define(strtoupper($configuration->fields['cfgkey']), $configuration->fields['cfgvalue']);
      }
      $configuration->MoveNext();
    }
    to
    Code:
    while (!$configuration->EOF) {
      /**
     * dynamic define based on info read from DB
     */
      if ($configuration->fields['configuration_group_id'] == 2 || 
        ($configuration->fields['configuration_group_id'] == 3 && $configuration->fields['cfgkey'] != 'UPLOAD_FILENAME_EXTENSIONS')) { 
        define(strtoupper($configuration->fields['cfgkey']), (int)$configuration->fields['cfgvalue']);
      } else { 
        define(strtoupper($configuration->fields['cfgkey']), $configuration->fields['cfgvalue']);
      }
      $configuration->MoveNext();
    }
    Zen Cart Pull-Request (PR) submitted: https://github.com/zencart/zencart/pull/2697
    Last edited by lat9; 2 Aug 2019 at 12:30 PM. Reason: Noting PR.

  3. #3
    Join Date
    Jul 2017
    Location
    Sotheastern, North Carolina, USA
    Posts
    5
    Plugin Contributions
    0

    Default Re: File Upload Attribute not working in v1.5.6c

    Thank you, this worked perfectly!

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: File Upload Attribute not working in v1.5.6c

    Noting that the solution for Zen Cart 1.5.7 is slightly different!

  5. #5
    Join Date
    Dec 2008
    Location
    Utah, USA
    Posts
    182
    Plugin Contributions
    10

    Default Re: File Upload Attribute not working in v1.5.6c

    Quote Originally Posted by lat9 View Post
    Noting that the solution for Zen Cart 1.5.7 is slightly different!
    So what is the solution in 1.5.7? Having the same issue after upgrading.
    Zen Cart Help and Design

    If you don’t build your dream, someone else will hire you to help them build theirs.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: File Upload Attribute not working in v1.5.6c

    Quote Originally Posted by brandonturpin View Post
    Quote Originally Posted by lat9 View Post
    Noting that the solution for Zen Cart 1.5.7 is slightly different!
    So what is the solution in 1.5.7? Having the same issue after upgrading.
    1.5.7 isn't released yet.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Dec 2008
    Location
    Utah, USA
    Posts
    182
    Plugin Contributions
    10

    Default Re: File Upload Attribute not working in v1.5.6c

    Quote Originally Posted by DrByte View Post
    1.5.7 isn't released yet.
    Oh, your right... well adding that for me broke the whole site.
    Zen Cart Help and Design

    If you don’t build your dream, someone else will hire you to help them build theirs.

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

    Default Re: File Upload Attribute not working in v1.5.6c

    In 1.5.7, this value is not in the database so the additional check is not required.
    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.

  9. #9
    Join Date
    Jan 2007
    Location
    Illinois, USA
    Posts
    312
    Plugin Contributions
    0

    Default Re: File Upload Attribute not working in v1.5.6c

    Quote Originally Posted by DrByte View Post
    1.5.7 isn't released yet.
    Now that 1.5.7 is released.... where would the specific settings be located?
    NTO: building a better network thru collaboration
    www.needtoorder.com | www.coffeewitheinstein.com

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: File Upload Attribute not working in v1.5.6c

    Quote Originally Posted by Carbonless View Post
    Now that 1.5.7 is released.... where would the specific settings be located?
    If you're talking about site-wide file extensions allowed in ALL upload activities on the site:
    https://docs.zen-cart.com/user/upgra.../#zen-cart-157

    Or, if it's for a specific page/form, edit your PHP code to tell the upload class the specific file extensions you support for THAT specific upload by passing the list of supported extensions as function parameters.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Thumbnail Preview of file after upload via Attribute File uploader?
    By NWFAP in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 7 Aug 2015, 03:40 AM
  2. v139h uploading artwork file (attribute) does not upload file
    By delia in forum General Questions
    Replies: 11
    Last Post: 1 Sep 2013, 08:41 PM
  3. File Upload Attribute - File Size Limit?
    By Genevieve in forum General Questions
    Replies: 2
    Last Post: 4 May 2010, 06:33 PM
  4. upload file attribute
    By mwsebesta in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 23 Sep 2009, 09:01 AM
  5. File attribute not working - its something to do with zen_run_normal()??
    By infocom in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 2 Apr 2008, 11:47 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