Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Maximum File Upload Size Problem (custom upload script outside Zen Cart)

    Hi All,

    I have installed a file upload feature at:

    http://www.silkblooms.co.uk/index.ph...e=testimonials

    However, it's proving impossible to limit the maximum file size for the uploads. I've tried three different approaches:

    1. admin/configuration/maximum values 2048000 (seems to have zero effect)

    2. The php.ini file which comes as part of the upload mod is supposed to limit file size uploads to the user specified size. Here is the content of my php.ini, but again, it's being totally ignored:

    PHP Code:
    file_uploads On
    post_max_size 
    2M
    upload_max_filesize 
    2M
    register_globals 
    On
    error_log 
    error_log
    error_reporting 
    2039
    log_errors 
    On 
    3. I have tried to limit the file upload size using a .htaccess file in the parent directory, one level above the folder where the files are uploaded. Again, it's being totally ignored. Here is the content of my .htaccess file:

    PHP Code:
    RewriteEngine On
    AllowOverride All

    AddHandler cgi
    -script .php .php3 .php4 .phtml .pl .py .jsp .asp .htm .shtml .sh .cgi
    Options 
    -Indexes
    Options 
    -ExecCGI

    deny from all
    <Files "^\w+\.(gif|jpe?g|png)$">
    order deny,allow
    allow from all
    </Files>

    AuthUserFile .htpasswd
    AuthGroupFile 
    /dev/null
    AuthName EnterPassword
    AuthType Basic

    require user wsabstract

    php_value upload_max_filesize 2M

    LimitRequestBody 2048000 
    Can anyone think why it's still allowing uploads of a greater size than specified?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Maximum File Upload Size Problem

    Your custom code (non Zen Cart) at /upload/index.php will be handling whatever you're doing with that iFrame.
    Similarly, if you are attempting to regulate things with .htaccess, then you'll have to do that in that folder as well.
    .

    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.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,336
    Plugin Contributions
    1

    Default Re: Maximum File Upload Size Problem

    Does that tool use Zen Cart function or 3rd party?

    Most 3rd party mods would have an option to limit file size. It is a lot easier than using php_ini or htaccess.

    If that mod doesn't have a condition for the file size you can add it to the header file.

    I have used such a tool a while back and it came with conditions such as file size and type.

  4. #4
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Maximum File Upload Size Problem

    Thanks for the response guys,

    Dr Byte: I tried puting the .htaccess file in the includes/uploads folder but as soon as a .htaccess file is put in there, it causes an internal server error inside the iFrame. It does not matter what content is in the .htaccess file as I stripped it back, testing a line at a time until it was empty. So, even an emty .htaccess file causes the following internal server error:

    PHP Code:
    Internal Server Error

    The server encountered an internal error 
    or misconfiguration and was unable to complete your request.

    Please contact the server administratorwebmaster@silkblooms.co.uk and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionallya 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request
    As for the custom code inside index.php I was hoping to limit file size in another way as my PHP skills aren't where I'd like them to be yet.


    CoolCarPartsOnline: The mod comes with 'built in' file size limit, but all it does is generate a php.ini and place it in the upload directory. It should really hard code the index.php file, but it doesn't do that. I've been in contact with the author and he may review the php if he can find time, but if I can find another approach in the meantime then that would be great. Perhaps you could tell me which mod you used in the past, or better still tell me how to limit the upload file size by adding a condition to the header?

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Maximum File Upload Size Problem

    You'll need to sort those issues out with your hosting company. It's likely that your server won't let you put PHP directives in your .htaccess files, and thus you'll need to use a php.ini file in that folder instead. Again, your hosting company can tell you what exactly the problem is, and can help you set the proper limits as far as PHP itself is concerned.
    As for your custom code, the author from whom you obtained that code is your best line of support.

    This is not a Zen Cart issue.
    .

    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.

  6. #6
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Maximum File Upload Size Problem (custom upload script outside Zen Cart)

    OK, I seem to have it working now. I dropped a copy of my php.ini into the file upload directory, and another in the parent folder where my original .htaccess is. Now, it's not allowing uploads of larger files.

    Just two questions now:

    1. It's not uploading the larger files, but it's not for the want of trying. When I try to upload a 3mb file, the little ajax-loader spins for a very long time as though it's actually uploading. It takes a few minutes, then just stops with no message.

    Is there a way to make it determine the file size 'before' attempting to upload and perhaps give the user a message that their file is too large and hasn't been uploaded?

    2. Other than custom coding the index.php file, is there a way to make php.ini ot .htaccess deny the upload of certain file types and only allow .gif .jpg .png ?

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Maximum File Upload Size Problem (custom upload script outside Zen Cart)

    You're talking about customizing a script that's completely separate from Zen Cart.
    I suggest you take that discussion to wherever you got your script from.
    .

    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.

  8. #8
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    984
    Plugin Contributions
    6

    Default Re: Maximum File Upload Size Problem (custom upload script outside Zen Cart)

    The Upload Point software was introduced in this thread

    http://www.zen-cart.com/forum/showpo...&postcount=168

  9. #9
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Maximum File Upload Size Problem (custom upload script outside Zen Cart)

    Notwithstanding, the problem HAS NOTHING TO DO WITH ZEN CART. It's custom code that's having conflicts as a result of how your server is configured vs the code you're running.

    The fact that you're running it inside an iframe which appears inside a page of your Zen Cart site is entirely irrelevant. Something running from an iframe is completely separate, and subject to its own interaction with the server.

    Best to get support for that code from the author who wrote it.
    .

    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.

 

 

Similar Threads

  1. File upload size problems
    By marknew in forum General Questions
    Replies: 2
    Last Post: 26 Nov 2010, 01:02 AM
  2. CSV File Upload Zen Cart newbie!!!!
    By tonybrown in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 19 Sep 2010, 11:54 AM
  3. File Upload Attribute - File Size Limit?
    By Genevieve in forum General Questions
    Replies: 2
    Last Post: 4 May 2010, 06:33 PM
  4. Restrict Maximum Image upload file size ?
    By greentrees in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 14 May 2009, 03:37 AM
  5. How Do I Increase The File Upload Size?
    By printjuce in forum Setting Up Categories, Products, Attributes
    Replies: 11
    Last Post: 31 Jan 2008, 02:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg