Forums / All Other Contributions/Addons / File Upload Required addon [Support Thread]

File Upload Required addon [Support Thread]

Started by 1100101 on 17 Jul 2010, 7:24 PM · Views: 7,782

Results 1 to 20 of 22
17 Jul 2010, 7:24 PM
#1
1100101 avatar

1100101

New Zenner

Join Date:
Sep 2008
Posts:
19
Plugin Contributions:
1

File Upload Required addon [Support Thread]

Allows a file attribute (optionally) to be required, similar to text attributes.

Errors resulting from insufficiently large values of post_max_size and upload_max_filesize are handled and errors resulting from failed upload attempts now prevent products from being added to the basket.

Cautions and advice regarding the setting of post_max_size and upload_max_filesize in relation to Maximum File Upload Size in the Zen Cart admin are displayed at the top of the Zen Cart admin if the settings are detected to be inappropriate.

Under Admin->Catalog->Attributes Controller the option "Attribute Required for Text" is changed to "Attribute Required for File/Text".

Download Link: http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1685

Please report any bugs/issues here

Thank you,
sj

13 Oct 2010, 4:50 PM
#2
3dperuna avatar

3dperuna

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

sj,

I just installed 1.3.9g fresh, then I carefully followed your installation instructions.

When I add go to the Attribute Controller, Add an Option then Insert (regardless of what is selected, addeded, etc). I'm getting a page with a single "f" displayed. Nothing in the Page Source, either.

Any ideas?

13 Oct 2010, 6:52 PM
#3
3dperuna avatar

3dperuna

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

I found the problem. The includes/languages/english/attributes_controller.php file had an 'f' as the first character of the file. Deleted it and we're good.

13 Oct 2010, 7:25 PM
#4
3dperuna avatar

3dperuna

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Ok... The Admin side works. I can require the upload field.

Now when I test the cart (using the classic "out of the box") cart (No other modules installed), I'm getting another blank screen when I "add to cart" with or without an uploaded file. Page source is blank.

13 Oct 2010, 8:04 PM
#5
3dperuna avatar

3dperuna

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Found the problem... I had made a minor modification to the upload.php file. By comparing the original with the new I was able to find my error. Sorry!

29 Jan 2011, 1:20 AM
#6
1100101 avatar

1100101

New Zenner

Join Date:
Sep 2008
Posts:
19
Plugin Contributions:
1

Re: File Upload Required addon [Support Thread]

Common bug:
The file upload is not required and a required text upload is also not required (check this if you are still not able to require the file upload). The item is simply added to the basket despite the text upload/file upload being required.

Possible Cause:
Missing database entries (not sure what causes this).

Solution:
-> Backup your database
-> Check that the following lines are missing from your database
-> Use "Admin->Tools->Install SQL Patches" to install the missing lines.

INSERT INTO `configuration` VALUES ('', 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Upload prefix', 'UPLOAD_PREFIX', 'upload_', 'Prefix used to differentiate between upload options and other options', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Text prefix', 'TEXT_PREFIX', 'txt_', 'Prefix used to differentiate between text option values and other option values', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Image Handler Version', 'IH_VERSION', '2.0', 'This is used by image handler to check if the database is up to date with uploaded image handler files.', 0, 100, NULL, '2007-06-06 16:47:03', NULL, 'zen_cfg_textarea_small(')

Thank you to grantc for this fix.

Original post:
http://www.zen-cart.com/forum/showpost.php?p=396323&postcount=20

29 Jan 2011, 1:39 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: File Upload Required addon [Support Thread]

Is this line supposed to be run if you don't use IH2?```php
INSERT INTO configuration VALUES ('', 'Image Handler Version', 'IH_VERSION', '2.0', 'This is used by image handler to check if the database is up to date with uploaded image handler files.', 0, 100, NULL, '2007-06-06 16:47:03', NULL, 'zen_cfg_textarea_small(')

29 Jan 2011, 1:41 AM
#8
1100101 avatar

1100101

New Zenner

Join Date:
Sep 2008
Posts:
19
Plugin Contributions:
1

Re: File Upload Required addon [Support Thread]

No. Just the first 3.

25 Feb 2011, 3:06 PM
#9
masantner avatar

masantner

New Zenner

Join Date:
Jun 2009
Posts:
16
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Having a bit of an issue: After installing, I am able to require the upload however, after creating new (non-file related) options am unable to set values for the new option. Recieve a duplicate entry error.

I created the Upload option first and it's ID is therefore '1'. it appears that any additional names are also given the ID of '1' when attempting to add option values and therefore a duplicate of the first named option (at least that's what it seems to be). Even though the option name is given a unique ID, in the option values it seems to always be '1'.

This is the error that appears:

1062 Duplicate entry '1-1' for key 1
in:
[insert into zen_products_options_values (products_options_values_id, language_id, products_options_values_name, products_options_values_sort_order) values ('1', '1', 'testing', '3')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Also, no matter what type of option I choose, they all show up as TEXT in the settings for the Attribute Controller.

Any ideas where the problem might lie (operator error or otherwise)?

Thanks

25 Feb 2011, 6:19 PM
#10
masantner avatar

masantner

New Zenner

Join Date:
Jun 2009
Posts:
16
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Problem Solved... I thought above issue was a problem associated with the "File Upload Required," however it was a database issue where deleted options were not removed from the database...

Thanks to DrByte (and his input in the regular forum) I was able to cure the issue...

Run this from SQL Patches in the Tool menu:

delete from products_options_values where products_options_values_id > 0;

15 Apr 2011, 7:24 PM
#11
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Just want to say thanks for this mod!

I was able to get it to work on a v1.3.8a install without an issue.

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor

15 Apr 2011, 7:36 PM
#12
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

I guess I spoke too soon.... :blush:

I have that "f" in the top left when viewing Admin page and I also have that message below the "f" stating:

php.ini setting post_max_size is less than double Maximum File Upload Size, file uploads will not function correctly.

So if I understand this correctly I might be able to update my .htaccess file

I guess the question is this... what line or modfication do I have to do to the .htaccess file to get this message to go away?

Thanks in advance!

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor

15 Apr 2011, 9:40 PM
#13
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Fixed both issues:

  1. Removed the "f" from attributes_controller.php from the mod.
  2. Updated the Admin>Configuration>Maximum Values>Maximum File Upload Size to 4000000 and that change cleared the php.ini error message.

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor

16 Apr 2011, 2:03 PM
#14
1100101 avatar

1100101

New Zenner

Join Date:
Sep 2008
Posts:
19
Plugin Contributions:
1

Re: File Upload Required addon [Support Thread]

Glad you were able to fix your problems jasmel and masantner.

Thank you jasmel for pointing out the typo "f" at the top of admin/includes/languages/english/attributes_controller.php.

I'm not quite sure how that slipped through all this time! You have a keen eye! :D I have resubmitted a version with this bug corrected and it should be available within the next week or so. :oops:

Regarding the setting of post_max_size and upload_max_filesize in general:

Problem:
You are given one or both of the following warning messages at the top of your Zen Cart Admin page.
-> "php.ini setting post_max_size is less than double Maximum File Upload Size, file uploads will not function correctly."
-> "php.ini setting upload_max_filesize is less than Maximum File Upload Size, file uploads will not function correctly."

Cause:
-> Values of upload_max_filesize and post_max_size in your php.ini size are not compatible with the value of Maximum File Upload Size in your Zen Cart admin.

Solution:
-> Note: Not all servers allow you to alter php.ini or use .htaccess to alter php settings. If the below solution does not work you should contact your server administrator.

-> Set Admin->Configuration->Maximum Values->Maximum File Upload Size to the maximum file size you want to allow users to upload. The value of Maximum File Upload size is in bytes (The default value of 2048000 bytes = 1.95 megabytes. Jasmel's setting of 4000000 bytes = 3.81 megabytes)

-> If you are still being given the warning messages you need to calculate the correct values of upload_max_filesize and post_max_size and alter them in either php.ini or .htaccess, follow the steps below.

-> upload_max_filesize should be a value bigger than Maximum File Upload size.

-> post_max_size should be at least double upload_max_filesize. If you are offering 2 file uploads on a single product then you should set post_max_size to 3 times the value of upload_max_filesize. If you are offering 3 file uploads on a single product set post_max_size to 4 times the value of Maximum File Upload size and so on.

-> To set these values do ONE of the following:
1) If you have access to your php.ini file, find the lines:

upload_max_filesize
post_max_size

Change the values to those you calculated above. You can set the size of upload_max_filesize and post_max_size by changing the lines in your php.ini, for example:

upload_max_filesize = 8M
post_max_size = 16M

Which means 8 megabytes and 16 megabytes respectively.
2) If you do not have access to your php.ini file find the .htaccess file in the root directory of your Zen Cart installation (or make one). Change the values to those you calculated above. You can set the size of upload_max_filesize and post_max_size by adding the following lines to your .htaccess file:

php_value  upload_max_filesize  8M
php_value  post_max_size  16M

Where 8M and 16M should be replaced by the values you calculated above.

-> There are also limits on the time an upload is allowed to take. These limits are also controlled by the php.ini file. You can read more about these settings and Maximum File Upload size in Zen Cart here: https://www.zen-cart.com/tutorials/index.php?article=406

Thanks.

P.S... It's probably worth mentioning that all of these settings are in play even without this modification. They are built into the php language and Zen Cart. All I actually did was add the warning messages to give people some idea when their settings were so grossly wrong that the module was likely to fail.

16 Apr 2011, 2:14 PM
#15
1100101 avatar

1100101

New Zenner

Join Date:
Sep 2008
Posts:
19
Plugin Contributions:
1

Re: File Upload Required addon [Support Thread]

Sorry 3DPeruna.

I've just realised that the error you experienced with the stray "f" was likely the same as jasmel's and was thus my fault.

When I first read your posts I assumed you had accidentially altered a file, when in fact, I had accidentally altered the file!

Sorry again. As I said I have uploaded the module without this critical typo and it should be available within the next week or so. Who knows how many human hours the stray "f" has wasted? Oh dear.

25 Apr 2011, 8:05 PM
#16
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

1100101:

setting of 4000000 bytes = 3.81 megabytes

I updated my file size notice to the customers with (3.8M) to more accurately reflect the true size limit. - This size is very suitable for a .jpg photo anyways.

Again... thanks for this mod! The "required" set on the file upload works wonderfully and I got my first order with an uploaded photo. (Dora Photo Personalized DVD)

:clap:

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor

9 Jul 2011, 10:41 AM
#17
hara avatar

hara

Zen Follower

Join Date:
Sep 2008
Posts:
397
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

Is this mod allowing customer to upload files(image and document) from the store site? Where the upload button located after installing?
I want it on customer check out so the uploaded file can be associated to this order. Any demo? Thanks.

9 Jul 2011, 1:42 PM
#18
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: File Upload Required addon [Support Thread]

I believe it would affect the standard "file" type attribute in a product. It will not be available after checkout, but while the customer is selecting the product.

9 Jul 2011, 4:30 PM
#19
hara avatar

hara

Zen Follower

Join Date:
Sep 2008
Posts:
397
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

gjh42:

I believe it would affect the standard "file" type attribute in a product. It will not be available after checkout, but while the customer is selecting the product.

I should tell more details of what I need. See if the mod can do.

For example, I'm selling plain white T-shirt. Accepting buyers to provide their own design logo by uploading image or file at the same time placing/checkout order. So the uploaded image/file will come with the order and use same order or invoice number. (It is better file management system). Then I can print the design logo on T-shirt and ship it next day.

Any suggestions would be appreciated.

10 Jul 2011, 6:08 PM
#20
hara avatar

hara

Zen Follower

Join Date:
Sep 2008
Posts:
397
Plugin Contributions:
0

Re: File Upload Required addon [Support Thread]

gjh42:

I believe it would affect the standard "file" type attribute in a product. It will not be available after checkout, but while the customer is selecting the product.

I got help from you posted below. Thank you!
http://www.zen-cart.com/forum/showpost.php?p=1043870&postcount=2