mr.teapot's avatar

Dropzone and Laravel - some JPGs fail to upload

Hey!

I've got a local installation of Laravel and I am using dropzone to upload images to the application.

However, some of the JPGs fail to upload.

The requests for the images that works has a mime-type of 'mimeType' => 'image/jpeg', while those that fail have 'mimeType' => 'application/octet-stream'. Yet they are all jpgs. I get a 422 response for the failed uploads.

All images from unsplash.com fail.

Does anyone have any idea why this is happening?

Thanks in advance,

/Teapot

0 likes
7 replies
lmxdev's avatar

422 is most likely a validation error

fabricecw's avatar

Hey Teapot

Could you check out the file extensions of the failed uploads? I run into same problems because the extension were uppercase.

mr.teapot's avatar

Hi!

One of the failing images have .JPG, but two other failing images have .jpg so I don't think that is the problem.

The only thing the failing images have in common is that the 'mimeType' => 'application/octet-stream' in the post request.

mr.teapot's avatar

I removed the "required" validation from the controller, now I get a FileNotFoundException when I upload the failing images. This happens with postman as well so I can rule out and any problems with dropzone.

All the failing files have a size > 2MB. A file with size 2MB is successfully uploaded.

mr.teapot's avatar

The upload_max_filesize in the php.ini was indeed causing these issues. Weird that the mime-type was changed when I echoed back the request.

I hope someone will search and find this thread if they have the same problem =)

1 like

Please or to participate in this conversation.