Let me tell about the problem. I have a form which is called «Image». It contains a field called «file» and it is checked as Image implementation. Here is a part of validation.yml:
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 is the problem? When I try to upload some images which have mime-type «application/octet-stream» and have normal extension like .jpg or .png I see an error which tells me that an image has invalid size. Then I try to display the object (an implementation) of «Image» through var_dump() and I see that the «size» field is 0 (it's why the error of invalid size is displayed).
So what I have do with such images to determine their size and download them successfully (I must say that with one of allowed mime-type it works pretty good)?
P.S. I'm sorry about my bad English skill. And as ever I will be thankfull for any answer!
There is new information!. All files which bigger than several megabytes are sent with «application/octet-stream» mime-type.
I add my comment which solved it as an answer so the question will have an answer:
There is new information!. All files which bigger than several megabytes are sent with «application/octet-stream» mime-type.
The problem is that either post_max_size or upload_max_filesize in your php.ini is limiting the size of the upload.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With