May 8, 2016
0
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);
}
Please or to participate in this conversation.