'Laravel video upload - issue with ios device, mime-type application/octet-stream
I created an API to upload videos.
when I upload a video from postman its works fine but when I use the same API with ios device file extension missing.
Request from POSTMAN
array (
'post_id' => '25',
'file' =>
Illuminate\Http\UploadedFile::__set_state(array(
'test' => false,
'originalName' => 'IMG_5190.MOV',
'mimeType' => 'video/quicktime',
'error' => 0,
'hashName' => NULL,
)),
)
Request from IOS
array (
'post_id' => '5331',
'file' =>
Illuminate\Http\UploadedFile::__set_state(array(
'test' => false,
'originalName' => 'phpKz6dKN',
'mimeType' => 'application/octet-stream',
'error' => 0,
'hashName' => NULL,
)),
)
File Upload Code
$file = $request->file('file');
$ext = $file->getclientoriginalextension() ? $file->getclientoriginalextension() : 'mov';
$size = $file->getSize();
$filename = Str::random(100) . date('his').'.'.$ext;
$localVideo = Storage::disk('public')->put($filename, file_get_contents($file));
So I just added an extension .mov if there is none.
someone please guide me to proper way to upload 'mimeType' => 'application/octet-stream' type files.
Solution 1:[1]
it is problem in your php.ini file. max_file_size.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ???????? ???????? |