Forums / General Questions / File Upload over 10mb directs to 404 not Found

File Upload over 10mb directs to 404 not Found

Views: 1,357

Results 1 to 13 of 13
11 May 2015, 8:09 PM
#1
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

File Upload over 10mb directs to 404 not Found

Hello,
I am using ZC V1.5.0, PHP version 5.4.39, database patch level 1.5.0, Linux server.

I am having an issue with a couple customers where if they try to upload files larger than 10mb (which is rare but it does happen) that they get sent to a 404 page not found after clicking "Add to Cart". I do have my errors set for if the upload fails to display "image not uploaded" and so on. I checked with my host (1and1) and they have a 40mb limit on file uploads. I am not really sure where to go from here. Please let me know if you can help or if you need any more information from me about my site.

Thanks,
Justin

12 May 2015, 1:05 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: File Upload over 10mb directs to 404 not Found

go to you ZenCart admin > tools > server/version info

Close to the top you should see - "PHP File Uploads: On Max Size: 2M"

See what you find - I bet not 40M - ask them if you can use a custom php.ini file and if so change this value in it

Zen-Venom Get Bitten

12 May 2015, 3:10 AM
#3
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: File Upload over 10mb directs to 404 not Found

Are the customers actually receiving a HTTP 404 (from the server) or are the customer's browsers requests timing out (due to the upload taking too long)?

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

12 May 2015, 1:38 PM
#4
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

Re: File Upload over 10mb directs to 404 not Found

Thanks for the quick replies, here is the server info from my admin page:

Server OS: Linux 3.2.65-grsec-infong-14351 Database: MySQL 5.1.73-log
Server Date: 05/12/2015 09:31:24 Database Date: 05/12/2015 09:31:24
Server Up Time: HTTP Server: Apache
PHP Version: 5.4.39 (Zend: 2.4.0) PHP Memory Limit: 120M PHP Safe Mode: Off
PHP File Uploads: On Max Size: 40M POST Max Size: 8M
Database Data Size: 1,130 kB Database Index Size: 603 kB

I had not considered the timeout of the browser? If that is the issue how would I know that is the cause and is there a fix for it?

Justin

12 May 2015, 1:43 PM
#5
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

Re: File Upload over 10mb directs to 404 not Found

Also meant to say I have been testing myself and receiving my 404 not found zencart page when uploading large files and it is redirecting in less than a minute. Those files never successfully upload to my server either.

12 May 2015, 2:33 PM
#6
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: File Upload over 10mb directs to 404 not Found

Post max size (all data sent via the POST including files) should be > upload size (max size of uploaded files).

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

12 May 2015, 2:36 PM
#7
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

Re: File Upload over 10mb directs to 404 not Found

Thanks, Ya once i saw that in the server info I thought that might be limiting it. I'll talk to my host and see if I am able to increase the post max size

12 May 2015, 2:49 PM
#8
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

Re: File Upload over 10mb directs to 404 not Found

So for now I have set my max upload file size on the zencart admin to 8mb but my question now is if i try uploading a larger file than 8mb why is it going to this 404 not found instead of an error message saying "your file is too large"?

12 May 2015, 7:23 PM
#9
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: File Upload over 10mb directs to 404 not Found

PHP manual:

...
post_max_size integer
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. ...
One must set post_max_size > upload_max_filesize. This is a PHP configuration which needs to be in place before uploads will work correctly / as expected. The POST needs space to accommodate all information sent via POST including: product id, attribute, quantity, all uploaded files in the same form, etc (all these must fit inside post_max_size).

Fixing this is critical if you want to allow larger uploaded files via PHP.

Note: Some HTTP(S) daemons also limit the post size (so the hosting provider may need to the configuration of these as well to ensure end users can upload larger files).

Justin G:

... I am using ZC V1.5.0, PHP version 5.4.39 ...
Note: Zen Cart 1.5.0 is past End of Life (reached on 19 March 2013). Zen Cart 1.5.0 is not fully compatible with PHP 5.4 out-of-box.

While this may not be the cause of the issue in the first post, I would take action on this item quickly.

I would ask the host to temporarily downgrade to PHP 5.3. Afterwards I would start rebuilding / upgrading the store to the current version of Zen Cart. When done with the rebuild / upgrade (and deployment of the next version), have the host switch back to PHP 5.4+.

New versions also include bugfixes, enhancements, compatibility fixes, security patches, etc. Always better to upgrade on your timetable, before things break and customers get upset.

Note: Many here recommend only installing Zen Cart from the distribution available from zen-cart.com. While third party "repackages" and "installers" (such as softaculous) work, the Zen Cart code in third party distributions may contain modifications. And unless you know EVERY way the third party version differs from the stock version available on zen-cart.com, it will be more difficult to obtain help here on the Zen Cart forums.

Justin G:

... I do have my errors set for if the upload fails to display "image not uploaded" ...
I am not aware of this option in a stock Zen Cart installation... When testing, a stock Zen Cart installation will just silently continue when the upload fails (w/o adding the attribute or issuing a 404).

Where are you setting this option? Have you installed a 3rd party Zen Cart module (or modified the add to cart process)? Was the store upgraded from a previous version of Zen Cart? How does the store differ from a stock version of Zen Cart 1.5.0? What is the URL displayed in the browser window? What does FireBug (or other developer tools) show as the HTTP status / code?

Note: I am unable to duplicate the issue in the first post under a stock installation of Zen Cart 1.5.0, 1.5.1, or 1.5.4 (Server: Linux 3.2, PHP 5.4.39, MySQL 5.5.41).

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

14 May 2015, 8:39 PM
#10
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

Re: File Upload over 10mb directs to 404 not Found

Thanks for all your help and info on my issue. If this helps to view my site and recreate the error our url is www.pogoheads.com

So I guess I will have to contact my host to change my php.ini settings to get the correct allowances on the max sizes

Ya I know I should upgrade, even though I am the web designer behind this site it is not my only job at my company so finding time is difficult.

When I was referring to having my errors set for an upload fail I just meant I defined the message to be displayed "define('ERROR_FILE_TOO_BIG', 'Warning: File was too large to upload!<br />Order can be placed but please contact the site for help with upload');"

I have only added a few modules - Paytrace payment module (which we are actually no longer using, now on authorize.net), I can't remember if UPS was included or not but that may be one I installed, and one called Customer Uploaded Files - List and Download which just created a menu in my admin area so our CSR can download images easily since most of them don't like/understand ftp clients for downloading. All the files for the last one were all installed in only my admin folder.

V1.5.0 was the initial install of ZC and I have never upgraded from that.

My template started with Sheffield Blue from www.picaflor-azul.com. With this as my starting point I have only had trouble with some javascript competing with the image slider on the home page. Which I removed any new javascript because of that.

Other than those I have mainly changed the CSS and added a few pieces of html to the product pages, home page, and the checkout pages.

The URL before the upload takes place is https://www.pogoheads.com/index.php?main_page=product_info&cPath=66&products_id=188 (this is just one of the products but it occurs on all of them)

After trying to add to cart with a large file in the upload I get sent to https://www.pogoheads.com/index.php?main_page=page_not_found

On Firebug I have two request while adding to cart: POST: Status 302 moved temporarily and GET 404 not found

Justin

15 May 2015, 2:19 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: File Upload over 10mb directs to 404 not Found

Perhaps PHP is throwing an error, and Apache is catching the error and attempting to go to an error page which it can't find and then your .htaccess is catching the not-found scenario of Apache not finding its ow error page, and thus redirecting you to the ZC page-not-found page.

Check the Apache and PHP error logs for the same timestamp as when you're getting that problem, and see what's recorded there.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

18 May 2015, 5:59 PM
#12
justin_g avatar

justin_g

New Zenner

Join Date:
May 2014
Location:
Pittsburgh
Posts:
10
Plugin Contributions:
0

Re: File Upload over 10mb directs to 404 not Found

That very well could be whats happening. I am having trouble locating where my php and apache logs would be. I have my debug logs from the cache and AIM logs but I have not seen any logs in there recorded during the exact time of my upload tests. Where might I find these logs if they are there?

Thanks,
Justin

18 May 2015, 6:42 PM
#13
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: File Upload over 10mb directs to 404 not Found

Where might I find these logs if they are there?
Apache and PHP error logs can be accessed by your host only as they are server activity logs

Zen-Venom Get Bitten