Team Kode
 · AI-powered software agency

How to insert uploadUrl to this FFUploadedFile costum code?

Custom Code

I need to insert on my custom code of FFUploadedFile, the uploadUrl property that i read on:
https://community.flutterflow.io/discussions/post/docs-for-ffuploadedfile-SmomdvrPyNigeWG

Anyone knows how to do it properly? The code from my costum action is bellow.
I mus to do it, because my API from Whatsapp, only accept a file from frontend in this way, and it's error response is here:
{

"error": true,

"code": 500,

"message": "TypeError: Cannot read properties of undefined (reading 'mimetype')"

}

I don't have a clue how to insert mimetype properly on FFUploadedFile, my guess is thath if can insert the url, the API will get the mimetype from there.

What have you tried so far?

I've got this code to convert an string base64 to a FFUploadedFile:

import 'dart:convert';

Future<FFUploadedFile> base64ToFFUploadedFile(String base64String) async {
  // preciso de uma ação que transforme uma string de base64 em um FFuploaded File
  // Decodifica a string base64
  final bytes = base64Decode(base64String);

  // Cria um ffuploadedFile com os bytes decodificados
  final ffuploadedFile = FFUploadedFile(
    bytes: bytes,
    name: "image.png",
  );

  // Retorna o ffuploadedFile
  return ffuploadedFile;
}
Did you check FlutterFlow's Documentation for this topic?
Yes