The front end sent me a video in base64 format. How should I convert it to a folder?

problem description

the front end sent me a video in base64 format. How should I convert it to the folder path

Php
May.20,2022

base64_encode/base64_decode


Encoding data using MIME base64: base64_decode


the problem is not clearly described. What is the video of base64?

my understanding is that the front end reads the video file as a stream string, and then encodes the stream string with base64. Your task is to save the stream as a video file to the specified location after anti-decoding.

if I understand that it conforms to your actual business, then you should do this:

suppose the file name and resource stream passed to you by the front end are $fileName='1.avi';$content='.';

, respectively.

that's what you should do

$filePath='/tmp/xxx/yyy/'.$fileName;
$fileContent=base64_decode ($content);

/ / Save the picture
file_put_contents ($filePath, $fileContent);

Note that the file name should also be passed to you, otherwise you don't know what format the file you saved is.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3db98-4da55.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3db98-4da55.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?