doujia1679 2018-10-22 12:07
浏览 41

我可以使用google drive api上传受密码保护的pdf吗?

So i've tried uploading a normal non password protected pdf file and it successfully gets uploaded using the below code. However if i try the same with a password protected file google throws a 400 error code (Bad Request) refrence: https://developers.google.com/drive/api/v3/reference/files/create

 $content = file_get_contents($file_path);
 $fileMetadata = new Google_Service_Drive_DriveFile(array(
                        'name' => 'dummy_name',
                        'mimeType' => 'application/vnd.google-apps.spreadsheet'));

 $file = $service->files->create($fileMetadata, array(
                        'data' => $content,
                        'mimeType' => 'application/pdf',
                        'uploadType' => 'multipart',
                        'fields' => 'id'));

Is it possible to upload a pdf with password protection even if i have the password with me?

  • 写回答

1条回答 默认 最新

  • dongzao3923 2019-03-13 09:52
    关注

    You seem to have the mimeType set to "application/vnd.google-apps.spreadsheet". I think it should work if you set it to "application/pdf"

    In my case, password protected file upload seems to work with PDFs, but not with DOCX files.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计