Framework: Certain iPhone photos fail Laravel validation

Created on 28 Mar 2017  Â·  2Comments  Â·  Source: laravel/framework

  • Laravel Version: 5.4.15
  • PHP Version: 7.0.15-0ubuntu0.16.04.4
  • Database Driver & Version: N/A

Description: Certain iPhone photos fail Laravel's validation, with error: "The image failed to upload." I've attached two photos taken from two different iphones demonstrating the problem. I am unsure of the cause, but I do not believe it to be mime type related. Opening an image that fails validation in Photoshop and then saving it back out causes continued failures, but blanking the image makes it pass validation. This makes me think there is something in the actual image content that causes validation to fail.

Steps To Reproduce:

Use this validation string:
$validator = Validator::make($request->all(), [
'image' => 'required|mimes:jpeg,png,jpg,gif,pdf,tiff,svg,ai,psd'
]);

Then attempt to upload/validate these two files:

works

fails

The first one passes validation, the second one fails.

Most helpful comment

Oh wow, good catch. I had actually checked that, but your post made me
revisit this and I realized our development server did not have the same
50MB limit that our production webserver has. Thanks for pointing this out!

On Tue, Mar 28, 2017 at 10:49 AM, Clayton Stone notifications@github.com
wrote:

Check your php.ini 'upload_max_size' and 'post_max_size'. I think the
'upload_max_size' may default to 2M. The second photo is bigger than that.
See this post
https://laracasts.com/discuss/channels/general-discussion/file-validation-failing-on-larger-files?page=1
on Laracasts.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/laravel/framework/issues/18541#issuecomment-289794520,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAqXtE2RnBJtJEbs2BE1HUJPCpswfBpkks5rqR3hgaJpZM4Mrr3w
.

All 2 comments

Check your php.ini 'upload_max_size' and 'post_max_size'. I think the 'upload_max_size' may default to 2M. The second photo is bigger than that. See this post on Laracasts. However, if it is actually the Laravel validation that is catching it....then maybe that's not the problem.

Oh wow, good catch. I had actually checked that, but your post made me
revisit this and I realized our development server did not have the same
50MB limit that our production webserver has. Thanks for pointing this out!

On Tue, Mar 28, 2017 at 10:49 AM, Clayton Stone notifications@github.com
wrote:

Check your php.ini 'upload_max_size' and 'post_max_size'. I think the
'upload_max_size' may default to 2M. The second photo is bigger than that.
See this post
https://laracasts.com/discuss/channels/general-discussion/file-validation-failing-on-larger-files?page=1
on Laracasts.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/laravel/framework/issues/18541#issuecomment-289794520,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAqXtE2RnBJtJEbs2BE1HUJPCpswfBpkks5rqR3hgaJpZM4Mrr3w
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lzp819739483 picture lzp819739483  Â·  3Comments

felixsanz picture felixsanz  Â·  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  Â·  3Comments

RomainSauvaire picture RomainSauvaire  Â·  3Comments

ghost picture ghost  Â·  3Comments