how to find the files by their name which is placed into google drive folder

Viewed 56

I develop a website based on PHP, to share pdf among our college students. those pdf files size are high. in desktop whenever student clicks the file, its show the file through browser pdf viewer.but the problem is in mobile google chrome it's every time download the pdf file and took a lot of time. I only need to show the pdf instead of download, like in mobile firefox. I tried in many methods(iframe, js viewers) but it does not work. so I placed the pdfs in a google drive and want to share them. I know how to share a single google drive file.

<a href='https://drive.google.com/file/d/file_link_that_generated_by_goole_drive/view?usp=sharing>

but how to share a pdf files that in google drive folder. in my local database, I add pdf name and their subject. so I need to get the files in drive folder by their name.

1 Answers

You cannot directly find files by their name with the Drive API.

You need to

  • Perform a Files:list request
  • Specify thereby the query parameter q to name = 'PASTE_THE_NAME_HERE'
  • With this request you can obtain the id(s) of matching file(s) (Careful! On Google Drive a folder can contain multiple files with the same name)
  • You can use this id for [Files: get]for your link.
Related