我按照文档(https://developers.google.com/drive/api/v3/manage-uploads#http---single-request)中的操作进行操作,但它不起作用:
var fileMetadata = {
name: e.target.files[j].name,
parents: this.currentDirectoryId ? [this.currentDirectoryId] : []
}
var media = {
mimeType: e.target.files[j].type,
body: e.target.files[j]
}
window.gapi.client.drive.files.create({
resource: fileMetadata,
media: media,
fields: 'id, name, mimeType, createdTime'
}).then(res => console.log(res))
文件已创建,但为空且名为“Untitled”,mimeType为“application/octet-stream”
12345678_0001
相关分类