file_upload 0.0.3 copy "file_upload: ^0.0.3" to clipboard
file_upload: ^0.0.3 copied to clipboard

a package to send images/videos in a request to the server

#file_upload A Flutter plugin to send files as a request to the server

Usage #

Please change the localhost url for the url server

import 'package:file_upload/file_upload.dart';


//In this example we use the localhost url but you will change the url
// for the url sever 
String _url = 'http://10.0.2.2:5000';
FileUpload fileUpload = FileUpload();

Future<void> sendFiles() async {
  String url = '$_url/request1';
   /* 
   uploadTwoFiles()
    Params: 
      String url,
      String fileKey1,
      String filePath1,
      String fileType1,
      String fileKey2,
      String filePath2,
      String fileType2
  */
  response1 = await fileUpload.uploadTwoFiles( url,'video',path1!,'mp4','image',path2!,'jpg');
  print(response1);
}

Future<void> sendFile() async {
  /*uploadFile()
  Params:
      String url, 
      String fileKey, 
      String filePath, 
      String fileType)
  */
  String url = '$_url/request2';
  // url,fileKey,filePath,fileType
  response2 = await fileUpload.uploadFile(url,'audio',path3!,'wav');
  print(response2);
}
2
likes
100
pub points
69%
popularity

Publisher

verified publishercodingminds.academy

a package to send images/videos in a request to the server

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, http, http_parser

More

Packages that depend on file_upload