Home Forums Support Error 500 when uploading files to an expense via Android app

This topic contains 7 replies, has 4 voices, and was last updated by  Hillel Coren 3 months, 4 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #22128



    First off, thanks for developing such a fantastic product!

    I’m self hosting Invoice Ninja (v4.5.14 running on Ubuntu/nginx/php) on my own server, and I can happily upload files and attachments to Expenses without problem via the web site. However, I am unable to do the same from the Android app – I just get an error message: 500: An error occurred.

    On the server, I get the following error in laravel-error.log:

    [2019-10-07 11:20:57] production.ERROR: ***ErrorException*** [0] : /var/www/ninja/app/Ninja/Repositories/DocumentRepository.php [Line 112] => getimagesize(): Read error! {"context":"PHP","user_id":1,"account_id":1,"user_name":"******","method":"POST","user_agent":"Dart/2.5 (dart:io)","locale":"en","ip":"XX.XX.XX.XX","count":1,"is_console":"no","is_api":"yes","db_server":"mysql","url":"api/v1/documents"} []

    Any thoughts?


    Hillel Coren

    I think the problem is with the image file itself (hence the ‘read error’), please check if it works with a different image format.



    Hi Hillel,

    You’re right it does seem to be an image format issue. A different image from a different source (WhatsApp) seems to work fine. However, this means I can’t upload any images taken by my phone camera via the app (Samsung Note 4).

    I don’t have this problem when uploading the same image from the web interface. That accepts everything just fine. Are the mobile app and web interface using different APIs? Is the mobile one perhaps a bit out of date?



    I get the exact same issue (self hosted) using the app and taking a picture to upload for an expense using a Samsung S8. I re-iterate this is a great platform and appreciate the hard work. If this could be looked into that would be great as it would be very handy on the go to use you mobile to capture receipts etc straight to the server without having to scan then send.

    PS i also ensure my php settings were correct to allow large post/max upload sizes.



    Hillel Coren

    That’s strange, the web and mobile apps rely on the same code.

    If anyone else is seeing an error please confirm you see the same “getimagesize(): Read error!” message in the logs.



    I am having the same issue:

    [2019-10-28 15:18:07] production.ERROR: ***ErrorException*** [0] : /var/www/html/ninja/app/Ninja/Repositories/DocumentRepository.php [Line 112] => getimagesize(): Read error! {“context”:”PHP”,”user_id”:1,”account_id”:1,”user_name”:”[USERNAME]”,”method”:”POST”,”user_agent”:”Dart/2.5 (dart:io)”,”locale”:”en”,”ip”:”[IP ADDRESS]”,”count”:1,”is_console”:”no”,”is_api”:”yes”,”db_server”:”mysql”,”url”:”api/v1/documents”} []

    I made two changes:


    post_max_size from 8M to 20M
    upload_max_filesize from 2M to 20M

    and in nginx.conf I added
    client_max_body_size 100M;

    • This reply was modified 4 months ago by  Woogi.


    Also, while I have have made those changes above, even on the Browser, it looks like my uploads need to be less than 2mb?


    Hillel Coren

    That sounds like a PHP config issue

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

Posted in: