Closed azamalvi closed 1 year ago
Can you please relay the exact message the API returns? 422 isn't anything to go off of alone, need the context from the message to know why your upload didn't pass validation.
Can you please relay the exact message the API returns? 422 isn't anything to go off of alone, need the context from the message to know why your upload didn't pass validation.
Status Code: 422 Unprocessable Content
You mentioned you adjusted your Nginx conf to allow 20mb, but did you also update your php.ini
's post_max_size
and upload_max_filesize
?
Yes the values are ok because I can upload more then 3mb of images as well. Only issue is with the Audio file
I would say to check your config/env for the audio size: https://github.com/RTippin/messenger/blob/92cca2804e74b79319be6177083c728ca0244038/config/messenger.php#L148
But the error you are getting is not a validation error from a file being too big. It's beyond my package/framework and something to do with your server/environment itself. May want to check your server/nginx logs.
Config is default.
'message_audio' => [ 'upload' => env('MESSENGER_MESSAGE_AUDIO_UPLOAD', true), 'size_limit' => env('MESSENGER_MESSAGE_AUDIO_SIZE_LIMIT', 10240), 'mime_types' => env('MESSENGER_MESSAGE_AUDIO_MIME_TYPES', 'aac,mp3,oga,ogg,wav,weba,webm'), ],
I have also checked the logs and did not find any errors. Can you please try it on your local with audio file only. It should be more then 2mb. Thanks
I have no issues uploading a 5mb audio file myself, and as I said, the error you are getting from the failed validation is not an issue with my package. I use laravels file validations here: https://github.com/RTippin/messenger/blob/92cca2804e74b79319be6177083c728ca0244038/src/Http/Request/BaseMessageRequest.php#L123-L129
Sounds to me like your audio file is corrupt or something in your environments that is not clear to me.
I'm uploading a 2MB mp3 file and it gives me an error "422 Unprocessable Content" if file size is less then 2mb then it works fine. Limit on my Nginx server is 20MB.