You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 73986f4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java
+49-30Lines changed: 49 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -25,55 +25,60 @@
25
25
26
26
importandroid.content.ContentResolver;
27
27
importandroid.content.Context;
28
+
importandroid.database.Cursor;
28
29
importandroid.net.Uri;
30
+
importandroid.provider.MediaStore;
29
31
importandroid.webkit.MimeTypeMap;
32
+
importio.flutter.Log;
30
33
importjava.io.File;
31
34
importjava.io.FileOutputStream;
32
35
importjava.io.IOException;
33
36
importjava.io.InputStream;
34
37
importjava.io.OutputStream;
38
+
importjava.util.UUID;
35
39
36
40
classFileUtils {
37
-
41
+
/**
42
+
* Copies the file from the given content URI to a temporary directory, retaining the original
43
+
* file name if possible.
44
+
*
45
+
* <p>Each file is placed in its own directory to avoid conflicts according to the following
46
+
* scheme: {cacheDir}/{randomUuid}/{fileName}
47
+
*
48
+
* <p>If the original file name is unknown, a predefined "image_picker" filename is used and the
49
+
* file extension is deduced from the mime type (with fallback to ".jpg" in case of failure).
Copy file name to clipboardExpand all lines: packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/FileUtilTest.java
0 commit comments