| Index: pkg/http/lib/src/multipart_file.dart
|
| diff --git a/pkg/http/lib/src/multipart_file.dart b/pkg/http/lib/src/multipart_file.dart
|
| index 220c28633f4cb59b7e63817e3a7fd6d6c614096a..07758b9097fb5713eebfed084c0643c7da3a2b7f 100644
|
| --- a/pkg/http/lib/src/multipart_file.dart
|
| +++ b/pkg/http/lib/src/multipart_file.dart
|
| @@ -5,7 +5,6 @@
|
| library multipart_file;
|
|
|
| import 'dart:async';
|
| -import 'dart:io';
|
| import 'dart:convert';
|
|
|
| import 'package:http_parser/http_parser.dart';
|
| @@ -13,6 +12,7 @@ import 'package:path/path.dart' as path;
|
| import 'package:stack_trace/stack_trace.dart';
|
|
|
| import 'byte_stream.dart';
|
| +import 'io.dart' as io;
|
| import 'utils.dart';
|
|
|
| /// A file to be uploaded as part of a [MultipartRequest]. This doesn't need to
|
| @@ -86,10 +86,13 @@ class MultipartFile {
|
| /// [filename] defaults to the basename of [filePath]. [contentType] currently
|
| /// defaults to `application/octet-stream`, but in the future may be inferred
|
| /// from [filename].
|
| + ///
|
| + /// This can only be used in an environment that supports "dart:io".
|
| static Future<MultipartFile> fromPath(String field, String filePath,
|
| {String filename, MediaType contentType}) {
|
| + io.assertSupported("MultipartFile.fromPath");
|
| if (filename == null) filename = path.basename(filePath);
|
| - var file = new File(filePath);
|
| + var file = io.newFile(filePath);
|
| return Chain.track(file.length()).then((length) {
|
| var stream = new ByteStream(Chain.track(file.openRead()));
|
| return new MultipartFile(field, stream, length,
|
|
|