Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sbkl's avatar
Level 17

Upload image to php server with mime type Application/octet-stream

Hello,

I have an iOS app sending an image to my php server. Then I want to upload this image to my php server.

When I use the web app to upload to the server, no problem. So it is not a permission issue. The image mimeType is image/jpeg.

However, when the image is coming from my iOS app, the mimeType is application/octet-stream.

And I understood php is blocking the upload because of this.

Any ideas how I can convert this file to an image?

Thank you.

public function uploadImage(Request $request) {
    $file = $request->file('image');
    $destinationPath = 'photos/';
    $extension = $file->getClientOriginalExtension();
    $fileName = rand(11111, 99999) . '.' . $extension;
    $file->move($destinationPath, $fileName);
}
0 likes
0 replies

Please or to participate in this conversation.