A
A
Anton K2021-11-29 11:49:37
Google
Anton K, 2021-11-29 11:49:37

Automatic file link update every day, Google Drive?

Hi all! Probably a crazy question, but I will be very glad if someone helps me solve my problem.

I have a pdf file on google drive and there is a public link to it.

I need to update the public link to a new one without replacing the file (because it weighs 200mb+). This should be done every 24 hours. You also need to write the new link to a variable in the php file.

Is it possible to do so?
How to use the Google Drive API correctly or is it not needed here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2021-11-30
@tosi_kk

You can use the Google Drive API to create a copy of a file without physically transferring the data over the network.
https://developers.google.com/drive/api/v3/referen...
On success, you can capture the new file id. If you copy a file directly to a public folder, then a link to sharing will immediately appear in its properties (you can request it through additional fields fields: "id,name,webViewLink").
After a successful response, you can delete the original file.
Note that with a 15GB Drive, you can make a 15GB copy of a file and your Drive will still function. During this time, you can safely delete the original file.
I have no idea what PHP you have there, but you can do it either by cron on the server, or by triggers on the service, or even through Google Apps Script, in the latter case, you will need to know where to put the result of the script, although, it can store in its properties and give a link on request, as an external service.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question