1 Attachment(s)
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.
Attachment 18589
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
Re: File Upload Attribute not working in v1.5.6c
Thank you, this worked perfectly!
Re: File Upload Attribute not working in v1.5.6c
Noting that the solution for Zen Cart 1.5.7 is slightly different!
Re: File Upload Attribute not working in v1.5.6c
Quote:
Originally Posted by
lat9
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.
Re: File Upload Attribute not working in v1.5.6c
Quote:
Originally Posted by
brandonturpin
Quote:
Originally Posted by
lat9
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.
Re: File Upload Attribute not working in v1.5.6c
Quote:
Originally Posted by
DrByte
1.5.7 isn't released yet.
Oh, your right... well adding that for me broke the whole site.
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.
Re: File Upload Attribute not working in v1.5.6c
Quote:
Originally Posted by
DrByte
1.5.7 isn't released yet.
Now that 1.5.7 is released.... where would the specific settings be located?
Re: File Upload Attribute not working in v1.5.6c
Quote:
Originally Posted by
Carbonless
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.