Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services S3铲斗的颤振载荷图像_Amazon Web Services_Amazon S3_Dart_Flutter - Fatal编程技术网

Amazon web services S3铲斗的颤振载荷图像

Amazon web services S3铲斗的颤振载荷图像,amazon-web-services,amazon-s3,dart,flutter,Amazon Web Services,Amazon S3,Dart,Flutter,我想使用AWS预先签名的密钥将图像上传到S3存储桶。此curl命令可用于: curl-X PUT--upload file.txt“签名密钥(URL)” 如何使用dart/FLATTER实现这一点?如果使用多部分表单post,http请求的http边界部分将存储在S3中文件的第一个字节中。不要 此功能的工作原理是: Future uploadImage(文件imageFile、字符串url、字符串imagetype)异步{ 最终长度=等待imageFile.length(); 最终路径=imag

我想使用AWS预先签名的密钥将图像上传到S3存储桶。此curl命令可用于:

curl-X PUT--upload file.txt“签名密钥(URL)”


如何使用dart/FLATTER实现这一点?

如果使用多部分表单post,http请求的http边界部分将存储在S3中文件的第一个字节中。不要

此功能的工作原理是:

Future uploadImage(文件imageFile、字符串url、字符串imagetype)异步{
最终长度=等待imageFile.length();
最终路径=imageFile.path;
打印('上传图像长度:$length路径:$path to url:$url');
试一试{
var response=wait http.put(url,正文:imageFile.readAsBytesSync(),标题:{“内容类型”:“image/”+imagetype});
打印(“上载图像状态代码:${response.statusCode}”);
打印(“上载图像结果:${response.body}”);
回来
}捕获(错误){
打印('上传错误:'+错误.toString());
投掷误差;
}
}  

如果使用多部分表单post,http请求的http边界部分将存储在S3中文件的第一个字节中。不要

此功能的工作原理是:

Future uploadImage(文件imageFile、字符串url、字符串imagetype)异步{
最终长度=等待imageFile.length();
最终路径=imageFile.path;
打印('上传图像长度:$length路径:$path to url:$url');
试一试{
var response=wait http.put(url,正文:imageFile.readAsBytesSync(),标题:{“内容类型”:“image/”+imagetype});
打印(“上载图像状态代码:${response.statusCode}”);
打印(“上载图像结果:${response.body}”);
回来
}捕获(错误){
打印('上传错误:'+错误.toString());
投掷误差;
}
}  

您是否尝试过使用dart
http
来发出与在curl中相同的请求?我尝试过-使用以下代码:var request1=http.MultipartRequest('PUT',Uri.parse(url))…files.add(新建http.MultipartFile.fromBytes('image',bytes,filename:filename,),);这不起作用。您是否遇到一些错误?您是否尝试过使用dart
http
来发出与curl中相同的请求?我有-使用以下代码:var request1=http.MultipartRequest('PUT',Uri.parse(url))…files.add(新的http.MultipartFile.fromBytes('image',bytes,filename:filename,),);这不起作用。你有什么错误吗?你能解释一下“url”是什么吗?我怎样才能自己生成它?你能解释一下“url”是什么吗?我怎样才能自己生成它