将图像和音频上传到AWS S3

时间:2020-11-03 17:14:02

标签: laravel amazon-web-services vue.js amazon-s3

我是AWS S3的新手,想知道如何使用VueJS(axios)将镜像从本地计算机上载到S3存储桶。

到目前为止,在我的laravel api中,我尝试使用这一行代码将其上传到S3中。

在我的 VueJS 中,我具有此功能,可向laravel中的api发送img

np.all(image_arr != [0, 0, 0], axis=-1)

在我的 ImageController 中,我有这个...

Request

当我发送POST请求时,它给我错误提示:

uploadphoto() {
    var d = new Date();
    var type_name = this.original_filename.split('.'); //some computed property I dispatched after uploading a file that gets the file's original name and extension.
    const form = new URLSearchParams();
    form.append('file_name', type_name[0]+('-')+d.getTime()+'.'+type_name[1]); //this gets; filename-<milliseconds>.png/jpg/mp3(extension)
    form.append('file', this.ia_attachment[0].file) //base64 encoded file /9j/4AAQSkZJRgABAQEASABIAAD/4gxY...
    this.axios.post('uploadimage', form, {
        headers: ''
    })
}

...而且,是否需要上传base64编码的文件或是否有其他上传方法?

0 个答案:

没有答案
相关问题