Flutter upload document : file key is missing in payload - Stack Overflow
Future<ApiResponse> apiPostFileSecured(
Uri uri,
String fieldKey,
Map<String, dynamic> jsonBody,
T Function(Map<String, dynamic>) fromJson,
Stream<List> stream, int length) async {
final headers = await createMultiPartAuthHeader();
print(headers);
if (headers == null) {
return ApiResponse(body: null, code: 401);
}
var request = http.MultipartRequest('POST', uri);
print(request);
//request.files.add(await MultipartFile.fromBytes("file", filePath!.toList()));
request.files.add(await http.MultipartFile('file', stream,length, contentType: new MediaType('document','pdf'), filename: "AWShostingdetails.pdf"));
sleep(Duration(seconds: 20));
request.headers.addAll(headers);
request.fields[fieldKey] = jsonEncode(jsonBody);
print("apiPostFileSecured +++++++++++++");
var streamResponse = await request.send();
print("apiPostFileSecured ************");
var response = await http.Response.fromStream(streamResponse);
return parseResponse(response, fromJson);
}
Below is my Payload: documentInfo: {"userDocumentDetailId":null,"documentName":"PAN Document","documentType":"PAN_CARD","fileDetailId":null,"fileType":"pdf","file":null,"documentVerified":null,"userDetailId":1,"fileName":"AWShostingdetails.pdf"}
In above payload data file key is missing. Please help me understand the issue.
- Rambus联手微软:研究量子计算内存
- 微软苹果和谷歌引导:硬件触控化或是大趋势
- visual c++ - MSVC errors out: undeclared identifier for SQL Server - Stack Overflow
- windows 10 - Gamemaker Mobile device Inconsistent Drag Speed Across Different Operating Systems (Win7 vs. Win10) - Stack Overflo
- How to optimize query performance in a large fact table with billions of rows? - Stack Overflow
- PowerShell not reading comment-based help section correctly - Stack Overflow
- c# - Getting username of logged in user with NegotiateWindows domain credentials - Stack Overflow
- android - No recomposition called when State Holder class modified - Stack Overflow
- r - Elegant vectorization of nested for loop - Stack Overflow
- c++ - templates are instantiated despite having extern template - Stack Overflow
- How to programmatically trigger "Next desktop background" in Windows using C#? - Stack Overflow
- rcpp - C++ AVX2 custom functions (e.g., "exp") not working on Windows (but work on Linux) - Stack Overflow
- i tried to get read edit manage storage in android java and output permission denied and not found in device setting - Stack Ove
- sublimetext3 - Sublime Text 34: copypaste all text excluding comments - Stack Overflow
- mouseevent - Need help for the Entitlements, Privacy Manifest, and Info.plist for System-Wide Mouse Click Monitoring and Typing
- angularjs - how to display a pdf in angular? - Stack Overflow
- node.js - Nestjs can't find build source after creating workspace - Stack Overflow