Zen Cart Logo
Forums / Bug Reports / Upload files and allowed types

Upload files and allowed types

Locked

Views: 2,697

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
28 Jun 2006, 20:33
#1
mark_kimsal avatar

mark_kimsal

New Zenner

Join Date:
Jun 2006
Posts:
14
Plugin Contributions:
0

Upload files and allowed types

If you upload a file and it is not one of the approved types, there is no error displayed to the user. This is a fairly serious bug because it does not respect the product attribute "Required" setting. It allows a product to enter the shopping cart without a required attribute.

29 Jun 2006, 02:22
#2
drbyte avatar

drbyte

Sensei

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

Re: Upload files and allowed types

/includes/classes/shopping_cart.php
line 1574-1575 contain:php $products_options_file = new upload('id'); $products_options_file->set_destination(DIR_FS_UPLOADS); add one more statement, turning the two lines into three, like this:```php
$products_options_file = new upload('id');
$products_options_file->set_destination(DIR_FS_UPLOADS);
$products_options_file->set_output_messages('session');



And update your template:
includes/templates/YOURTEMPLATE/common/tpl_main_page.php
around line 110 you have:```php
<?php
 /**
  * prepares and displays center column
  *
  */
 require($body_code); ?>
```insert this above that:```php
<!-- bof upload alerts -->
<?php if ($messageStack->size('upload') > 0) echo $messageStack->output('upload'); ?>
<!-- eof upload alerts -->
29 Jun 2006, 18:14
#3
mark_kimsal avatar

mark_kimsal

New Zenner

Join Date:
Jun 2006
Posts:
14
Plugin Contributions:
0

Re: Upload files and allowed types

The provided fixes do properly display an error message when the wrong file type is submitted now.

But, the effects of bypassing the required upload attribute still remain. Empty uploads are not checked against the required setting of the file upload attributes.

29 Jun 2006, 18:55
#4
drbyte avatar

drbyte

Sensei

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

Re: Upload files and allowed types

While I'm sure having "required" uploads may be a desired feature for some, it's not part of the existing feature set of Zen Cart.