Image uploading doesn't work on Web [Web] #173
Replies: 3 comments 1 reply
-
This is not the issue with the library. In File class you have a method called readAsBytes() and readAsBytesSync() it returns Future and Unit8List respectively. so using tis method u can retrieve image bytes. so using this you upload the file using a multipart request to any of your server. Then return that uploaded Image's url from _onImagePickCallback function Example: // Renders the image picked by imagePicker from local file storage
} You can refer this article to upload image to amazon s3 You can refer this article to upload image to Firebase Storage |
Beta Was this translation helpful? Give feedback.
-
I understand that it is impractical to have an actual image or any other document added into Quill data format but also having every image uploaded might be unnecessary in an editing phase of the Rich Text Document and it would be better to upload just the final files when the Rich Text is submitted. I think Quill could be improved by letting us to add something like "Path Place Holders" and we could just tell what file and type of the file it would be on the generated paths. Can this thread become a feature request? |
Beta Was this translation helpful? Give feedback.
-
I had a solution is using Future<String> onImagePickCallback(File file) async {
var imageBytes = await compressImage(file);
var base64image = base64.encode(imageBytes);
return "data:image/webp;base64,$base64image";
}
Future<String?> webImagePickImpl(
OnImagePickCallback onImagePickCallback) async {
final result = await FilePicker.platform.pickFiles();
if (result == null) {
return null;
}
var webFile = result.files.first;
var mfs = MemoryFileSystem();
File file = mfs.file('temp.jpg');
file.writeAsBytes(webFile.bytes!.toList());
return onImagePickCallback(file);
} But I don't know how to pass default style to |
Beta Was this translation helpful? Give feedback.
-
Image uploading doesn't work on Web
Error: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
at Object.throw_ [as throw] (http://localhost:65041/dart_sdk.js:5032:11)
at platform_channel.MethodChannel.new._invokeMethod (http://localhost:65041/packages/flutter/src/services/system_channels.dart.lib.js:953:21)
at _invokeMethod.next ()
at http://localhost:65041/dart_sdk.js:37210:33
at _RootZone.runUnary (http://localhost:65041/dart_sdk.js:37081:59)
at _FutureListener.thenAwait.handleValue (http://localhost:65041/dart_sdk.js:32337:29)
at handleValueCallback (http://localhost:65041/dart_sdk.js:32864:49)
at Function._propagateToListeners (http://localhost:65041/dart_sdk.js:32902:17)
at _Future.new.[_completeWithValue] (http://localhost:65041/dart_sdk.js:32750:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:65041/dart_sdk.js:32771:35)
at Object._microtaskLoop (http://localhost:65041/dart_sdk.js:37333:13)
at _startMicrotaskLoop (http://localhost:65041/dart_sdk.js:37339:13)
at http://localhost:65041/dart_sdk.js:33110:9
Beta Was this translation helpful? Give feedback.
All reactions