为什么将S3中的图像保存为字符(����94qgs��jX���z)而不是图像?

我在前端使用angular和node,在后端使用springboot。使用邮递员将图像发布到S3时,图像可以成功发布,但是,当使用我的Web应用程序时,图像会以一串长长的字符/字母/符号发布。我在做什么错了?

HTML:

<input type="file" (change)="onFileSelected($event)">
<button mat-raised-button type="button" mat-button color="primary" (click)="onUpload()">Upload</button>```


.ts:

```import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Component ({
    selector: 'upload-images',templateUrl: './upload-images.html',styleUrls: ['./upload-images.css']
})

export class UploadImagesComponent {
    selectedFile: File = null;

    constructor(private http: HttpClient) {}

    onFileSelected(event) {
        this.selectedFile = <File>event.target.files[0];
    }

    onUpload() {
        const formData = new FormData();
        formData.append('file-0',this.selectedFile,this.selectedFile.name);
        this.http.post('http://localhost:3000/storage/uploadFile',formData)
        .subscribe(res => {
            console.log(res);
        });
    }
}```
songbab 回答:为什么将S3中的图像保存为字符(����94qgs��jX���z)而不是图像?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3107218.html

大家都在问