我想在数字海洋上上传视频。但是我遇到了错误。
public function videoFileUpload($video, $folder_name, $filename){
//$extension = $video->extension();dd($extension);
//$mimeType = $video->getMimeType();
// $folder = env('APP_DIGITAL_FOLDER').Auth::user()->fname.'_'.Auth::user()->lname.'_'.Auth::user()->id.'/'.$folder_name.'/';
//$folder = env('APP_DIGITAL_FOLDER').Auth::user()->fname.'_'.Auth::user()->lname.'_'.Auth::user()->id;
//$image_name = time().'.'.$extension;
//$digital_path = Storage::disk('do_spaces')->put($video, fopen($folder . $filename, 'w+'), 'public');
//$stream = fopen($filePath, 'w');
//Storage::disk('do_spaces')->put($video, fopen($folder, 'w+'));
//$path = env('APP_DIGITAL_OCEAN').Auth::user()->fname.'_'.Auth::user()->lname.'_'.Auth::user()->id."/".$folder_name."/".$filename;
//dd($video);
//$extension = $video->extension();
//$mimeType = $video->getMimeType();
$folder = env('APP_DIGITAL_FOLDER').Auth::user()->fname.'_'.Auth::user()->lname.'_'.Auth::user()->id.'/'.$folder_name.'/';
$image_name = time().'.mp4';
$v = $video->getRealPath();
$digital_path = Storage::disk('do_spaces')->putStream($folder . $image_name, fopen($v, 'r+'));
$path = env('APP_DIGITAL_OCEAN').Auth::user()->fname.'_'.Auth::user()->lname.'_'.Auth::user()->id."/".$folder_name."/".$image_name;
return $path;
}
错误是您无法在数组上调用getRealPath()方法。该如何解决?
请有人可以帮助我吗?谢谢。