Php reads and saves base64-encoded video content

the front end gets the video address of base64
how does the server convert video files and store them in a folder?
$r = file_put_contents ($path, base64_decode ($videoData)); / / returns the number of bytes
) use the above code to store the video volume correctly, but why can"t you play the video

Mar.24,2021

take php as an example:

//  base64 
$video_url = base64_encode($base64);

$output_filename = "test.mp4";

$host = $video_url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);

print_r($result); 

// 
$fp = fopen($output_filename, 'w');
fwrite($fp, $result);
fclose($fp);
Menu