I using a custom option on the product detail a type file

I need limit this input to 10MB

It can be done from magento options or should I modify some file

Thank you


I'm not sure how you setup the upload but in PHP you can do stuff like this:

if(isset($_FILES['uploaded_file'])) {
    $maxsize    = 2097152;

    if(($_FILES['uploaded_file']['size'] >= $maxsize)) {
        exit('File too large. File must be less than 2 megabytes.');

On top of that you can use php.ini settings to limit the upload size:

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
  • No where is the php file upload file, but the other solution seems useful I have to contact the server administrator to see if you can do it from php.ini Whether it will comment that this was – Francisco Javier Lorenzo Berna Feb 15 '16 at 11:54
  • The first part of my comment is related to the php upload file. You've got to find the related controller and adapt the code I pasted to your specific case. – Raphael at Digital Pianism Feb 15 '16 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.