chunkedRelayUploadFile method

  1. @override
Future<bool> chunkedRelayUploadFile(
  1. Uri url,
  2. String totalChunks,
  3. String currentChunk,
  4. String serverType,
  5. String uploadPath,
  6. String uploadName,
  7. String mimeType,
)
override

Implementation

@override
Future<bool> chunkedRelayUploadFile(
  Uri url,
  String totalChunks,
  String currentChunk,
  String serverType,
  String uploadPath,
  String uploadName,
  String mimeType,
) async {
  try {
    final request = http.Request('POST', url);
    request.bodyFields = {
      'totalChunks': totalChunks,
      'currentChunk': currentChunk,
      'serverType': serverType,
      'uploadPath': uploadPath,
      'uploadName': uploadName,
      'mimeType': mimeType,
    };
    final resp = await request.send();
    await resp.stream.bytesToString();
    if (resp.statusCode != 200) {
      return false;
    }
    return true;
  } catch (err) {
    logger.severe('Error at StorageUtilImpl.chunkedRelayUploadFile >>> $err');
    return false;
  }
}