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预签名URL中的上载是否成功完成?_Amazon Web Services_Amazon S3 - Fatal编程技术网

Amazon web services 如何确定S3预签名URL中的上载是否成功完成?

Amazon web services 如何确定S3预签名URL中的上载是否成功完成?,amazon-web-services,amazon-s3,Amazon Web Services,Amazon S3,使用S3,我可以生成一个预先签名的URL来上传文件,但我无法从另一个资源中确定: 上载是否成功完成 另一个上传正在进行中 我是在Expo的FileSystem.uploadAsync的背景下问这个问题的,根据后台上传的文档 这是我上传的代码片段 const startResult = await this.webClient.post("/v3/upload/start", { category: meta.category, c

使用S3,我可以生成一个预先签名的URL来上传文件,但我无法从另一个资源中确定:

  • 上载是否成功完成
  • 另一个上传正在进行中
  • 我是在Expo的
    FileSystem.uploadAsync
    的背景下问这个问题的,根据后台上传的文档

    这是我上传的代码片段

    
          const startResult = await this.webClient.post("/v3/upload/start", {
            category: meta.category,
            contentType: meta.contentType,
            contentMd5Hash: fileInfo.md5,
            contentLength: fileInfo.size,
          });
          if (startResult.status !== 200) {
            throw new Error(
              `start result got ${startResult.status} expecting 200.  ${startResult.data}`
            );
          }
    
          const {
            presignedUploadUrl,
            contentMd5,
            completionToken,
          } = startResult.data;
    
          const result = await FileSystem.uploadAsync(
            presignedUploadUrl,
            fileInfo.uri,
            {
              headers: {
                "Content-MD5": contentMd5 as string,
                "Content-Type": meta.contentType,
              },
              httpMethod: "PUT",
            }
          );
    
          // I need to do this to indicate that the upload was completed
          // All this tells the backend that it is done, but there's no other
          // proof that it was done.
          const completeResult = await this.webClient.post("/v3/upload/complete", {
            completionToken,
            presignedUploadUrl,
          });
    
          const { artifactId } = completeResult.data;
    
          console.log(artifactId);
    
    

    当你说Expo的
    FileSystem.uploadAsync
    时,你使用的是什么?它返回一个。那么,您是否尝试过检查HTTP状态并比较它是尽快返回还是在上传成功后返回?我仍在尝试了解它是如何工作的,但我还没有实现它。我只是通过邮递员进行测试。你能提供你已经尝试过的代码实现吗?这可以提供一些可以介绍的信息。