We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Some documentation to show how to use file_picker withReadStream set would be helpful, for working/uploading big files.
The text was updated successfully, but these errors were encountered:
Yes, I might add one.
Sorry, something went wrong.
@vhaegar1526 You can pick and upload a large video file using this code for example:
import 'package:http/http.dart' as http; import 'package:http_parser/http_parser.dart'; import 'package:mime/mime.dart'; void main() async { final result = await FilePicker.platform.pickFiles( type: FileType.video, allowedExtensions: [ 'mp4', 'webm', ], withData: false, withReadStream: true, ); if (result != null) { final file = result.files.first; var uri = Uri.https('siasky.net', '/skynet/skyfile'); var stream = http.ByteStream(file.readStream); var request = http.MultipartRequest('POST', uri); final mimeType = lookupMimeType(file.filename ?? ''); var multipartFile = http.MultipartFile( 'file', stream, file.size, filename: file.filename, contentType: mimeType == null ? null : MediaType.parse(mimeType), ); request.files.add(multipartFile); final httpClient = http.Client(); final response = await httpClient.send(request); if (response.statusCode != 200) { throw Exception('HTTP ${response.statusCode}'); } final body = await response.stream.transform(utf8.decoder).join(); print(body); } }
Added to the docs. Thank you @redsolver.
No branches or pull requests
Some documentation to show how to use file_picker withReadStream set would be helpful, for working/uploading big files.
The text was updated successfully, but these errors were encountered: