Ejemplo: carga de imagen flutter
var d = "$tmpFile";
var dd = d.split("'");
var filename = dd[1].split("https://foroayuda.es/").last;
FormData formData = new FormData.fromMap({
"user_id": "3225",
"image": await MultipartFile.fromFile(dd[1], filename: "$filename"),
});
var response = await dio.post(
'http://10.0.2.2/test/upload.php',
data: formData,
onSendProgress: (received, total) {
if (total != -1) {
print((received / total * 100).toStringAsFixed(0) + "%");
}
},
);
print(response);
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)