我有以下上传器:
const uploader = (props) => {
let context = props
let uploaderObj = new FineUploaderS3({
options: {
request: {
endpoint: "https://" + props.fileCredentials.bucket + ".s3.amazonaws.com",
// accessKey: props.fileCredentials.access_key,
},
signature: {
version: 4
},
credentials: {
accessKey: props.fileCredentials.access_key,
sessionToken: props.fileCredentials.session_token,
secretKey: props.fileCredentials.secret_key,
expiration: props.fileCredentials.expiration,
},
chunking: {
enabled: true
},
objectProperties: {
region: props.fileCredentials.region,
bucket: props.fileCredentials.bucket,
acl: 'private',
key(id) {
let name = context.fileCredentials.key_prefix + this.getName(id)
return name
},
},
callbacks: {
onCredentialsExpired: function(){
requestCredentials()
},
onComplete: function(id, name, response, xhr ){
debugger
sendFileUploadKey(key)
}
}
}
})
return uploaderObj
}
我想提供所提供的代码中所述文件的名称。为了简单起见,我们假设它是一个静态值:'12345'
。该键确实返回正确的值。但是,在onComplete回调中,它返回的名称不是键,而是文件本身的名称。
它以某种方式忽略了我的key选项,并赋予它文件名本身的值而不是key。
有什么想法可能会这样吗?