更改更新文件上的Google云端硬盘mimeType [英] change Google Drive mimeType on update file
问题描述
我正在尝试为我的Web应用程序将另存为"添加到Google驱动器功能.系统会向用户显示Google Picker,然后选择要保存的文件.此时,应用程序已成功更新文件的内容,但不会更改要覆盖的文件的mimeType.
I am trying to make a "Save as" to google drive functionality for my web app. The user is shown the Google Picker and chooses a file to save over. At this point the application is updating the content of the file successfully, but it doesn't change the mimeType of the file being overwritten.
api参考指定了有关mimeType元数据的以下内容: 文件的MIME类型.只有在上传新内容时才可变(这种情况).此字段可以保留为空,而mimetype将由上载的内容的MIME类型确定."
The api reference specifies the following about the mimeType metadata: "The MIME type of the file. This is only mutable on update when uploading new content [this is the case]. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type."
我将其留空.实际上,我正在做一个简单的上传到PUT https://www.googleapis.com /upload/drive/v2/files/ {fileId}.并且http请求的Content-Type标头设置为要上传的文件的mimeType.在这种情况下(如果有帮助)是"application/vnd.ms-project".我还尝试将uploadType = media参数添加到url中,但没有成功.
I am leaving it blank. In fact, I am doing a simple upload to PUT https://www.googleapis.com/upload/drive/v2/files/{fileId}. And the http request has the Content-Type header set to the mimeType of the file being uploaded. In this case (if this helps) is "application/vnd.ms-project". I also tried adding the uploadType=media parameter to the url, with no success.
我还尝试使用Api运动场进行多部分更新.将元数据内容发送为空{},错误消息为类型不受支持的内容:application/vnd.ms-project".有趣的是,它不受支持,因为我确实设法用相同的mimeType创建了一个新文件,没有问题.
I also tried making a multipart update using the Api playground. Sent the metadata content empty {} and the error message was "Unsupported content with type: application/vnd.ms-project". Funny it is unsuported because I did manage to create a new file with the same mimeType, with no problem.
该怎么办?有任何建议吗?
What to do? Any sugestions?
推荐答案
您不能使用常规Blob替换现有的本机Docs文件.用Blob更新docs文件的唯一方法是打开Docs转换,这对于Microsoft Project文件是不可能的.
You can't replace an existing native Docs file with a regular blob. The only way to update a docs file with a blob is switching on the Docs conversion which is not possible for a Microsoft Project file.
这篇关于更改更新文件上的Google云端硬盘mimeType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!