Zen Cart Logo
Forums / Bug Reports / Error: File type not allowed. .0

Error: File type not allowed. .0

Views: 1,502

Results 1 to 6 of 6
16 Mar 2020, 18:13
#1
brandonturpin avatar

brandonturpin

Zen Follower

Join Date:
Dec 2008
Location:
Utah, USA
Posts:
183
Plugin Contributions:
7

Error: File type not allowed. .0

I upgraded my zencart website to the latest release (1.56). The site has been working for about 10 years. Some of our products have the file upload attribute. After upgrading I am getting an error that the file type is not allowed (.jpg). The error is: "Error: File type not allowed. .0"

I can not determine how to fix it, or set what file types are allowed for the attribute upload. It worked before the upload.

16 Mar 2020, 18:30
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Error: File type not allowed. .0

Why is the file coming in named as ".0" ? If you want to allow *.0 files, add the .0 to the list of supported file types.

16 Mar 2020, 20:43
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Error: File type not allowed. .0

DrByte:

Why is the file coming in named as ".0" ? If you want to allow *.0 files, add the .0 to the list of supported file types.
Unfortunately, the fix for ZC 1.5.6c, specifically set the check against items in the maximum configuration area to require being an integer. This was identified "later(?)" as being too stringent. A result of that is that when the error message for the upload class is generated:

               $this->message_stack(ERROR_FILETYPE_NOT_ALLOWED . ' .' . implode(', .', $this->extensions), 'error');

It somewhat seems as if one has entered an extension of "0" or ".0", but as can be seen in the above message, the extension list is "pulled" from and a period is applied as a prefix. Therefore, even though a valid extension (or extension list) was present at some point, pre-processing of the extension list in ZC 1.5.6c (without the additional "fix" provided in the newer ZC v156 branch) causes the extension(s) to be 0 and not matching the attempted upload unless someone has actually renamed their file to have a ".0" extension. Could do that I guess if they left the expected extension before that. So a file called mypic.jpg could be stored on their own computer as mypic.jpg.0 and the store owner would have to remove the ".0" to get back to the original filename...

See: https://github.com/zencart/zencart/blob/v156/includes/init_includes/init_db_config_read.php#L24-25

As compared to:
https://github.com/zencart/zencart/blob/v1.5.6c/includes/init_includes/init_db_config_read.php#L24-25

For those not seeing the lines being highlighted after following the above link(s), the lines in question are 24 and 25, specifically the differences in line 25...

17 Mar 2020, 18:50
#4
margecc avatar

margecc

Zen Follower

Join Date:
Feb 2007
Location:
Ontario, Canada
Posts:
234
Plugin Contributions:
0

Re: Error: File type not allowed. .0

I'm having the same problem. My file type that I'm trying to upload is a .jpg (I've also tried .png) and it is not being allowed. The error message I'm getting in the shopping cart is "Error: File type not allowed. .0"
Sorry MC1245678, I don't think I understand what changes I am to make.
Running V1.5.6c
Site: af-company.com

17 Mar 2020, 20:15
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Error: File type not allowed. .0

margecc:

I'm having the same problem. My file type that I'm trying to upload is a .jpg (I've also tried .png) and it is not being allowed. The error message I'm getting in the shopping cart is "Error: File type not allowed. .0"
Sorry MC1245678, I don't think I understand what changes I am to make.
Running V1.5.6c
Site: af-company.com
This is the specific change to incorporate:
https://github.com/zencart/zencart/commit/5ac27f153cc9b33215c09a4029e29091be6c3b66
It's result can be seen in the first link that I posted:
See:
https://github.com/zencart/zencart/b...ead.php#L24-25

24 Mar 2020, 13:31
#6
margecc avatar

margecc

Zen Follower

Join Date:
Feb 2007
Location:
Ontario, Canada
Posts:
234
Plugin Contributions:
0

Re: Error: File type not allowed. .0

That fix worked perfectly, thank you very much. Sorry mc12345678, now that I reread your original post was completely clear. This is what happens with you move to working from home and homeschooling at the same time. Your brain melts down.