Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http status error [500] when uploading image in multipart #1592

Closed
iresolveservices opened this issue Nov 9, 2022 · 3 comments
Closed

Http status error [500] when uploading image in multipart #1592

iresolveservices opened this issue Nov 9, 2022 · 3 comments

Comments

@iresolveservices
Copy link

New Issue Checklist

DioError [DioErrorType.response]: Http status error [500]
Source stack:
#0 DioMixin.fetch (package:dio/src/dio_mixin.dart:4

#0 DioMixin.fetch (package:dio/src/dio_mixin.dart:488:35)
#1 DioMixin.request (package:dio/src/dio_mixin.dart:483:12)
#2 DioMixin.post (package:dio/src/dio_mixin.dart:97:12)
#3 HttpService.executeRequest (package:aaaa /api_core/http_service.dart:161:32)

#4 RequestManager.executeDataRequest (package:aaaa /api_core/request_manager.dart:32:20)

#5 ProfileNetwork.editProfile (package:aaaa /screens/tab_profile/profile_network.dart:35:26)

#6 _ProfileViewState.editProfile (package:aaaa /screens/tab_profile/profile_view.dart:485:16)

@iresolveservices iresolveservices changed the title Http status error [500] Http status error [500] when uploading image in multipart Nov 9, 2022
@iresolveservices
Copy link
Author

my code

try{
response = await dio.post(
request.url,
data: formData,
options: Options(headers: {
'Accept': 'application/json',
}, contentType: "application/x-www-form-urlencoded",),
);
debugPrint('request.formData response ${response}');
} on DioError catch (e) {
tokenMap.remove(cancelToken);
if (!completer.isCompleted) {
completer.complete(_parseErrorResponse(e, request));
}
}

@iresolveservices
Copy link
Author

var mPart= request.file!=null && request.file!=''? await MultipartFile.fromFile('${request.file}', filename: 'upload.png',):'';

@iresolveservices
Copy link
Author

it closed accidentally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants