Welcome Guest, Not a member yet? Register   Sign In
Problem with mime_in only for heavy image
#1

I have this input:

PHP Code:
<input type="file" class="d-none" id="featuredImage" accept=".png, .jpg, .jpeg" name="meta[featured_image]"

I set the following validation rule:

PHP Code:
'meta.featured_image'   => 'mime_in[meta.featured_image,image/png,image/jpg,image/jpeg]|max_size[meta.featured_image,1024]' 

if I upload an image of 5kb all works well, but when I try to upload an image of 3.2Mb I get:

The filetype you are attempting to upload is not allowed.

if I inspect the file heavy image using:


PHP Code:
var_dump($this->request->getFile('meta.featured_image')->getMimeType()); 


I get "directory", but it's a .jpeg (I have attached the image that causing the issue on this post).
If instead I upload the image of 5Kb and print getMimeType() I get: "image/png"

I'm running the application over nginx and php-fpm, and I set client_max_body_size 100M; inside location directive of nginx, but I don't think is this the problem.

Any idea?
Reply
#2

max_post_size and max_upload_size need to also be set to the save value.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB