putFile_Request method

StreamedRequest putFile_Request(
  1. File file,
  2. FileStat fileStat,
  3. PathUri path, {
  4. DateTime? lastModified,
  5. DateTime? created,
  6. String? checksum,
  7. void onProgress(
    1. double progress
    )?,
})

Returns a request to put a new file at path with file as content.

lastModified sets the date when the file was last modified on the server. created sets the date when the file was created on the server. checksum has to follow checksumPattern. It will not be validated by the server. onProgress can be used to watch the upload progress. Possible values range from 0.0 to 1.0.

See:

Implementation

http.StreamedRequest putFile_Request(
  File file,
  FileStat fileStat,
  PathUri path, {
  DateTime? lastModified,
  DateTime? created,
  String? checksum,
  void Function(double progress)? onProgress,
}) {
  // Authentication and content-type headers are already set by the putStream_Request.
  // No need to set them here.
  return putStream_Request(
    file.openRead(),
    path,
    lastModified: lastModified,
    created: created,
    checksum: checksum,
    contentLength: fileStat.size,
    onProgress: onProgress,
  );
}