I want to send an image to the server and upload it. I did this with the following code but it did not upload to the server. I have to send a parameter containing a photo with the name of "img" to the server. In Postman the upload operation is performed, but it is not uploaded in the flutter.
Future<String> uploadImage(filename) async {
var model=widget.parent.selectedJobModel;
var request = http.MultipartRequest('POST', Uri.parse(baseUrl+"update_job"));
request.headers.addAll({
"key":reqKey,
"token":widget.parent.widget.spParent.userLogin,
"user_id":widget.parent.widget.spParent.userNo,
"job_id":model.job_id,
});
request.files.add(await http.MultipartFile.fromPath('img', filename));
var res = await request.send();
return res.reasonPhrase;
}