阿里云 oss 服务 flutter 版插件。
代码可参考 example。记得将 token server 地址、bucket 名称替换成你项目的值。
An aliyun oss plugin for flutter.
License: MIT License
您好,我看了我们之前Android客户端的代码,当时使用的的是
aliyun提供的 Android sdk,向阿里云 upload 数据时,还会设置 callback 相关的参数
类似
`
put.setCallbackParam(new HashMap<String, String>() {
{
put("callbackUrl", OSS_CALLBACK_URL);
put("callbackBody", "{"object":${object},"size":${size},"type":${x:type},"uid":${x:uid}}");
put("callbackBodyType", "application/json");
}
`
请问在 aly_oss 中upload时,如何设置callback参数?
服务端接口都有统一的安全校验,获取 Token 接口要加验证信息怎么办?
AlyOss: 8217de6b-624b-4eb2-a7c3-e81ebb2554e3
W/System.err( 6431): android.os.NetworkOnMainThreadException
W/System.err( 6431): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1565)
W/System.err( 6431): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:115)
W/System.err( 6431): at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
W/System.err( 6431): at java.net.InetAddress.getByName(InetAddress.java:1106)
W/System.err( 6431): at com.alibaba.sdk.android.oss.common.utils.OSSUtils.isValidateIP(OSSUtils.java:795)
W/System.err( 6431): at com.alibaba.sdk.android.oss.OSSImpl.(OSSImpl.java:133)
W/System.err( 6431): at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:116)
W/System.err( 6431): at tech.jitao.aly_oss.MethodCallHandlerImpl.init(MethodCallHandlerImpl.java:98)
W/System.err( 6431): at tech.jitao.aly_oss.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:46)
W/System.err( 6431): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
W/System.err( 6431): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
W/System.err( 6431): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
W/System.err( 6431): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err( 6431): at android.os.MessageQueue.next(MessageQueue.java:336)
W/System.err( 6431): at android.os.Looper.loop(Looper.java:174)
W/System.err( 6431): at android.app.ActivityThread.main(ActivityThread.java:7695)
W/System.err( 6431): at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 6431): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
W/System.err( 6431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
I/flutter ( 6431): oss=========={instanceId: 8217de6b-624b-4eb2-a7c3-e81ebb2554e3, requestId: a99036bb-39bb-4ed1-8f1e-9ff34f2e190f}
I/flutter ( 6431): {success: true}
aly_oss/ios/Classes/AlyOssPlugin.m
Line 136 in 8bdb8f6
aly_oss/ios/Classes/AlyOssPlugin.m
Line 146 in 8bdb8f6
......
var fileKey = 'test/images/${_uuid.v1()}.jpg';
await _alyOss.upload(UploadRequest(_uuid.v4(), value.data.bucket, fileKey, pickedFile.path));
// 卡住了,无法往下执行
BotToast.showText(text: "图片上传完成!");
Log.d("https://xxxx.oss-cn-shanghai.aliyuncs.com/$fileKey");
......
could it be used in commercial programs?
调用init的时候,Android控制台会抛出异常,但是不影响使用
W/System.err(23259): android.os.NetworkOnMainThreadException
W/System.err(23259): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1565)
W/System.err(23259): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:115)
W/System.err(23259): at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
W/System.err(23259): at java.net.InetAddress.getByName(InetAddress.java:1106)
W/System.err(23259): at com.alibaba.sdk.android.oss.common.utils.OSSUtils.isValidateIP(OSSUtils.java:795)
W/System.err(23259): at com.alibaba.sdk.android.oss.OSSImpl.(OSSImpl.java:133)
W/System.err(23259): at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:116)
W/System.err(23259): at tech.jitao.aly_oss.MethodCallHandlerImpl.init(MethodCallHandlerImpl.java:98)
W/System.err(23259): at tech.jitao.aly_oss.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:46)
W/System.err(23259): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
W/System.err(23259): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
W/System.err(23259): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
W/System.err(23259): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(23259): at android.os.MessageQueue.next(MessageQueue.java:336)
W/System.err(23259): at android.os.Looper.loop(Looper.java:174)
W/System.err(23259): at android.app.ActivityThread.main(ActivityThread.java:7356)
W/System.err(23259): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(23259): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/System.err(23259): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
多个图片上传怎么做?
var result = await _alyOss
.init(InitRequest(_uuid.v4(), 'https://<your server>/get-security-token', 'oss-cn-beijing.aliyuncs.com', '<your aes key>', '<your iv>'));
我想请教下这个参数是哪里来的
Hello, could you provide a clear example on how to use the plugin? I looked into the /example/lib/main.dart file, but wasn't sure what do I have to pass in the InitRequest arguments.
For instance, how do you obtain an 'aes key' and 'iv' in this example? :
var result = await _alyOss .init(InitRequest(_uuid.v4(), 'https://<your server>/get-security-token', 'oss-cn-beijing.aliyuncs.com', '<your aes key>', '<your iv>'));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.