Skip to main content
Version: 2.x.x

Upload and Retrieve the Temporary File - Flutter

This guide demonstrates how to upload and retrieve files from VideoSDK's temporary file storage system.

uploadBase64File()​

  • By using the uploadBase64File() method of the Room class, you can upload your file to Videosdk's Temporary storage.

  • The uploadBase64File() method only works with base64. Therefore, it is necessary to convert your file into base64 format.

  • You have to pass base64Data,token,fileName as parameter in uploadBase64File() function.

  • The function will return the corresponding fileUrl, which you can then use to retrieve the file.

void uploadFile() async {
String base64Data = "<Your File's base64>"; //Convert your file to base64 and pass here
String token = "<VIDEOSDK_TOKEN>";
String fileName = "myImage.jpeg"; // Provide name with extension here
String url = await room.uploadBase64File(
base64Data: base64Data,
token : token,
fileName : fileName,
)
print("fileUrl $url");
}

fetchBase64File()​

  • By using the fetchBase64File() method of the Room class, you can retrieve your file from Videosdk's Temporary storage.

  • You have to pass the fileUrl which is returned by uploadBase64File() function, and the token as parameters to retrieve a file.

  • This function will return the image in the form of base64.

void fetchFile() async {
String url = "<Your FileUrl>" //Provide fileUrl which is returned by uploadBase64File()
String token = "<VIDEOSDK_TOKEN>"
String base64 = room.fetchBase64File(
token: token,
url: url,
)
print("base64 $base64");
}
note

The file stored in the system will be automatically deleted once the current room/meeting comes to an end.

Got a Question? Ask us on discord