huhx / flutter_oss_aliyun

阿里云oss sdk的flutter版本
MIT License
61 stars 23 forks source link

为啥上传的图片都被限制93b大小,图片都打不开 #60

Open 4396mingkai opened 3 months ago

4396mingkai commented 3 months ago

1721287057231 每次上传图片提示成功,但是实际上都失败了是什么原因 var resp = await Client().putObject( filePath.codeUnits, picName, option: PutRequestOption( onSendProgress: (count, total) { print("send: count = $count, and total = $total"); }, onReceiveProgress: (count, total) { print("receive: count = $count, and total = $total"); }, override: true, aclModel: AclMode.inherited, storageType: StorageType.standard, headers: {"cache-control": "no-cache"}, // callback: const Callback( // callbackUrl: "callbackUrl", // callbackBody: "{\"mimeType\":\${mimeType}, \"filepath\":\${object},\"size\":\${size},\"bucket\":\${bucket},\"phone\":\${x:phone}}", // callbackVar: {"x:phone": "android"}, // calbackBodyType: CalbackBodyType.json, // ), ), ); 这是实现代码,resp 没有返回值,filePath是本地图片地址,picName是存到oss的图片名称,请问一下这个问题出在哪里啊

huhx commented 3 months ago

final Response resp = await Client().putObjectFile( "/Users/aaa.pdf", fileKey: "aaa.png", option: PutRequestOption( onSendProgress: (count, total) { print("send: count = $count, and total = $total"); }, onReceiveProgress: (count, total) { print("receive: count = $count, and total = $total"); }, aclModel: AclMode.private, callback: Callback( callbackUrl: callbackUrl, callbackBody: "{\"mimeType\":\${mimeType}, \"filepath\":\${object},\"size\":\${size},\"bucket\":\${bucket},\"phone\":\${x:phone}}", callbackVar: {"x:phone": "android"}, calbackBodyType: CalbackBodyType.json, ),
), );

huhx commented 3 months ago

filePath.codeUnits这个使用的有问题,如果使用putObject方法,第一个参数是文件流,不是文件路劲的bytes(filePath.codeUnits)。

4396mingkai commented 3 months ago

filePath.codeUnits这个使用的有问题,如果使用putObject方法,第一个参数是文件流,不是文件路劲的bytes(filePath.codeUnits)。

这个可以上传成功,但是没有返回图片地址是什么原因 image 这个resp是空的