mirror of
https://gitee.com/lijingbo-2021/open-anylink-web.git
synced 2025-12-30 11:02:25 +00:00
通过预签名URL上传文件时设置'Content-Type'
This commit is contained in:
@@ -15,7 +15,10 @@ export const mtsUploadServiceForImage = async (requestBody, { originFile, thumbF
|
||||
// 2 上传原图
|
||||
const originResponse = await fetch(uploadOriginUrl, {
|
||||
method: 'PUT',
|
||||
body: originFile
|
||||
body: originFile,
|
||||
headers: {
|
||||
'Content-Type': originFile.type || 'application/octet-stream' // 设置 Content-Type
|
||||
}
|
||||
})
|
||||
|
||||
if (!originResponse.ok) {
|
||||
@@ -26,7 +29,10 @@ export const mtsUploadServiceForImage = async (requestBody, { originFile, thumbF
|
||||
if (uploadThumbUrl !== uploadOriginUrl) {
|
||||
const thumbResponse = await fetch(uploadThumbUrl, {
|
||||
method: 'PUT',
|
||||
body: thumbFile
|
||||
body: thumbFile,
|
||||
headers: {
|
||||
'Content-Type': thumbFile.type || 'application/octet-stream' // 设置 Content-Type
|
||||
}
|
||||
})
|
||||
|
||||
if (!thumbResponse.ok) {
|
||||
@@ -56,7 +62,10 @@ export const mtsUploadService = async (requestBody, { originFile }) => {
|
||||
// 2 上传文件
|
||||
const uploadResponse = await fetch(uploadUrl, {
|
||||
method: 'PUT',
|
||||
body: originFile
|
||||
body: originFile,
|
||||
headers: {
|
||||
'Content-Type': originFile.type || 'application/octet-stream' // 设置 Content-Type
|
||||
}
|
||||
})
|
||||
|
||||
if (!uploadResponse.ok) {
|
||||
|
||||
Reference in New Issue
Block a user