I want to copy file from google drive to another server using php.
I have used google drive picker and when user clicks on any file I used to get download url, I was thinking that it can be done through copy function, but it didn't work.
Any solution Please.
function getDownloadurl(fileId) {
var request = gapi.client.request({
'path': '/drive/v2/files/' + fileId,
'params': { 'maxResults': '1000' },
callback: function (responsejs, responsetxt) {
var fileDownloadUrl = responsejs.downloadUrl;
$.ajax({
type: "POST",
url: "ajax-files/copy_drive_file.php",
data: { gd_url:fileDownloadUrl },
async:false,
success: function(data)
{
}
});
copy_drive_file.php
$sourcePath=$_POST['gd_url'];
copy($sourcePath, 'sss/file.jpg');