Comments (5)
This issue is stale because it has been open for 14 days with no activity.
from flutter_file_picker.
same issue. any solution for this?
from flutter_file_picker.
@alim699 here is my temporary solution. this is not guaranteed solution but worked for me for all of my use cases
`
import 'dart:convert';
import 'package:mime/mime.dart';
Future checkAndFixFile(String path) async {
String mime = getFileMime(path);
if (mime.contains("image")) {
Uint8List fileData = await File(path).readAsBytes();
String fileBase64 = base64Encode(fileData.sublist(0, 5 * 1024)).substring(0, 250);
if (fileBase64.startsWith("AAAA") && fileData.length > 1 * 1024 * 1024) {
return await fixWhatsappVideo(fileData);
} else {
return path;
}
} else {
return path;
}
}
Future fixWhatsappVideo(Uint8List fileData) async {
var tempDir = await getTemporaryDirectory();
var time = DateTime.now().millisecondsSinceEpoch;
String filePath = '${tempDir.path}/$time.mp4';
await File(filePath).writeAsBytes(fileData);
return filePath;
}
`
from flutter_file_picker.
This issue is stale because it has been open for 14 days with no activity.
from flutter_file_picker.
This issue was closed because it has been inactive for 14 days since being marked as stale.
from flutter_file_picker.
Related Issues (20)
- `NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress'` HOT 3
- Android: image picker and file picker apps with launchMode=singleInstance doesn't work (more specifically Samsung devices) HOT 3
- Because searching_folders_files depends on file_picker_example any which doesn't exist (could not find package file_picker_example at https://pub.dev), version solving failed HOT 1
- App crashes since 6.2.0 when opening file using FileType.image on Android HOT 2
- App crashes when selecting an image HOT 9
- Unable to pick sf2 file (sound font) on Android HOT 2
- Choose photo on ios error HOT 5
- 2 files same name, different folder, returns same path for both files HOT 1
- [Android] user is still able to select images when allowedExtensions contains "pdf" only HOT 2
- Missing the transparency when picking PNG files from storage HOT 4
- Package is very hard to use, nullability semantics in particular HOT 1
- Not Load File Bytes on Windows HOT 2
- Unable to pick file bytes when Web is running on iOS HOT 4
- `allowCompression` invalid? HOT 1
- [Android]`READ_EXTERNAL_STORAGE` permission HOT 7
- Necesito ayuda, HOT 2
- iOS saveFile crash , because of there is no file in Document. HOT 2
- Failed to retrieve path from bundle. HOT 2
- FilePicker getDirectoryPath Temporarily Freezes App on Windows HOT 5
- Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_file_picker.