Unable to load image with "application / octet-stream" mime type in Symfony2

Let me talk about the problem. I have a form called Image. It contains a field called "file" and is verified as an image implementation. Here is the validation.yml part:

noxaeterna\MainBundle\Model\Image:
constraints:
    - Propel\PropelBundle\Validator\Constraints\UniqueObject:
        fields: hash
        message: "   ."
properties:
    name:
        - NotBlank:
            message: "   ."
        - Length:
            max: 255
            maxMessage: "     {{ limit }} ."
    file:
        - NotBlank:
            message: "  "
        - Image:
            maxSize: 20M
            mimeTypes: ["image/jpeg", "image/gif", "image/png", "image/x-png", "image/x-citrix-png", "image/x-citrix-jpeg", "image/pjpeg"]
            minWidth: 1
            minHeight: 1
            minWidthMessage: "     {{ limit }}   ."
            minHeightMessage: "     {{ limit }}   ."
            sizeNotDetectedMessage: "  :    ."
            mimeTypesMessage: "  ."
            maxSizeMessage: "   ({{ size }} ).     {{ limit }}."
            uploadIniSizeErrorMessage: "   ({{ size }} ).     {{ limit }}."
            uploadFormSizeErrorMessage: "   ({{ size }} ).     {{ limit }}."
            uploadErrorMessage: "  ."

      

So what's the problem? When I try to load some images with a mime type "application / octet-stream" and have a normal extension like .jpg or .png I see an error that tells me the image is of an invalid size. Then I try to display the "Image" object (implementation) via var_dump () and I see that the "size" field is 0 (meaning the error is displayed as an invalid size).

So what do I do with images like this to determine their size and load them successfully (I have to say that it works very well with one of the allowed mime types)?

PS Sorry for my poor English skills. And as always, I will be grateful for any answer!

New information has appeared! ... All files larger than a few megabytes are sent with the "application / octet-stream" mime type.

+3


source to share


1 answer


I am adding my comment which resolved it as an answer, so the question will have an answer:

New information has appeared! ... All files larger than a few megabytes are sent with the "application / octet-stream" mime type.



The problem is that either post_max_size or upload_max_filesize in your php.ini limits the upload size.

+6


source







All Articles