Open X-Shao opened 1 month ago
Maybe I also have the same problem, But I have an error message
server.post('/test', (req, res) async {
final file = await req.payload();
res.send("string");
});
type 'String' is not a subtype of type 'Iterable<int>'
#0 ContextRequest.payload.<anonymous closure> (package:server_nano/src/context/context_request.dart:136:24)
<asynchronous suspension>
<input
type="file"
onChange={(e) => {
console.log(e.target.files);
const formData = new FormData();
formData.append('type', 'this.state.value');
formData.append('title', 'this.state.title');
formData.append('file', e.target.files[0]);
axios(pathAddApiString('test'), {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
},
data: formData,
}).then((res) => {});
}}
/>