Android image file sent to php upload image file is application/octet-stream type and not image/jpeg?

前端 未结 4 1625
不思量自难忘°
不思量自难忘° 2020-12-09 22:38

Hello all hope someone can can help- To fininsh my android app I just need to finish the class were the user can upload there image to the server(MySql).

All works w

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 23:27

    application/octet-stream or image/jpeg is only the mime-type the HTTP client (browser) has added as additional information next to the binary file-data itself.

    So the mime-type shouldn't be of any issue here. It's just that you see a difference between the requests for the case your program fails, but this must not be the cause of your issue.

    So you're basically looking at the wrong place.

    Instead you should add error and condition checking to your code. Especially precondition checks so that you know that your script can properly operate on the data it gets provided.

    From what you have made visible in your question, there is nothing more specifically I can add. Hope this is helpful anyway.

    Also the PHP Manual has a section about file-uploads which contains some useful information incl. dealing with error-cases.

    Next to that your code might just have a problem with how you insert the data into your database, so the problem might not be related at all with the file-upload technically.

提交回复
热议问题