Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TMSFMXCloudGDrive overwrite file on upload needed

 Post Reply Post Reply
Author
Gabriel Cristea View Drop Down
New Member
New Member
Avatar

Joined: 04 Oct 2018
Posts: 12
Post Options Post Options   Quote Gabriel Cristea Quote  Post ReplyReply Direct Link To This Post Topic: TMSFMXCloudGDrive overwrite file on upload needed
    Posted: 25 Jul 2019 at 12:33pm
Hi,

How can i overwrite a file when upload to google drive ?

With TMSFMXCloudDropBox1, TMSFMXCloudSkyDrive1 and TMSFMXCloudYandexDisk1 same file is overwrite on cloud when upload, but with TMSFMXCloudGDrive the file are added!?

Thank you
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2112
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jul 2019 at 4:50pm
Hi,

Pleae note that this is the default behaviour of the Google Drive API.
At this time there is no built-in functionality available in TMSFMXCloudGDrive to autmatically overwrite a file on upload.
However, this is a good suggestion and we'll investigate if this feature can be added in a future version.
Back to Top
Gabriel Cristea View Drop Down
New Member
New Member
Avatar

Joined: 04 Oct 2018
Posts: 12
Post Options Post Options   Quote Gabriel Cristea Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jul 2019 at 5:03pm
But if i delete the target file first, then upload the new one instead, do you consider a functional ideea ?

Something like that:

 //get targetfile.txt id
xGDrive := TGDriveItem.Create(nil);
xGDrive.ItemType := ciFile;
if TMSFMXCloudGDrive1.SearchFile('targetfile.txt', true) then
xGDrive := TGDriveItem(TMSFMXCloudGDrive1.Drive.Items[0]);
 
 //delete targetfile.txt 
TMSFMXCloudGDrive1.Delete(xGDrive);

//upload targetfile.txt
<blablabla>
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2112
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 29 Jul 2019 at 8:49am
That looks like a good workaround.
Just keep in mind that if you are doing a large number of operations this will increase the number of HTTP requests considerably.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down