I am using Loopj's android-async-http This is my code:
File file = new File("sdcard/food.jpg");
params.put("image", file);
My problem is, php server received the images as application/octet-stream
instead of image/jpg
. I need it to be image/jpg
as my server guy white-list uploaded files that have types of image/jpg
, image/png
, etc.
UPDATE 1
I've tried adding content type parameter to the application. However, php code still recognized it as application/octet-stream
.
params.put("image", new FileInputStream(file), "image/jpg");
UPDATE 2
Since I need to move on with the project, what we do right now is propose server guy to implement mime sniffing by using exif. In php, we do it with exif_imagetype(). All is well, so far. I will keep this question open until we find the solution that is implementable in android.