Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    23
    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: 117
Size:  37.7 KB

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,311
    Plugin Contributions
    72

    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
    3
    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
    9,311
    Plugin Contributions
    72

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

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

 

 

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