Print Page | Close Window

Dowload file from a folder ?

Printed From: TMS Software
Category: FMX Components
Forum Name: FMX Cloud Pack
Forum Discription:
Printed Date: 12 Nov 2019 at 7:28am

Topic: Dowload file from a folder ?
Posted By: Gabriel Cristea
Subject: Dowload file from a folder ?
Date Posted: 21 Mar 2019 at 12:09pm

How can i download a file localized in a folder (with no selection on Treeview) with TMSFMXCloudGDrive1 and TMSFMXCloudSkyDrive1 ?

For TMSFMXCloudDropBox1 and TMSFMXCloudYandexDisk1 i use this code and work ok,
 // DropBox - download from specific folder - work OK!
            if xCloud.ClassNameIs('TTMSFMXCloudDropBox') then
              xDrop := TDropBoxItem.Create(nil);
              xDrop.ItemType := ciFile;
              xDrop.Path := xFolder + '/' + xFileName;
              xCloud.Download(xDrop, xTargetFile);

Thank you !

Posted By: Bart Holvoet
Date Posted: 21 Mar 2019 at 12:40pm

Please note that GDrive requires a DownloadURL and SkyDrive an ID instead of a Path to be able to download a file.
You should be able to use the Search function to retrieve the required information for files similar as with retrieving a specific folder.

Posted By: Gabriel Cristea
Date Posted: 21 Mar 2019 at 1:54pm
Hi Bart,

Sorry again, but can you help me with my code please ?
None of then are work properly 

          // GDrive
            if xCloud.ClassNameIs('TTMSFMXCloudGDrive') then
              xGDrive := TGDriveItem.Create(nil);
                 if TMSFMXCloudGDrive1.SearchFile(xCloudFolder + '/' + xCloudFile, true) then
                xGDrive := TGDriveItem(TMSFMXCloudGDrive1.Drive.Items[0]);
              TMSFMXCloudGDrive1.Download(xGDrive,  xTargetFile);

            // SkyDrive
            if xCloud.ClassNameIs('TTMSFMXCloudSkyDrive') then
              // FOLDER
              xSkyFolder := TSkyDriveItem.Create(nil);
              TMSFMXCloudSkyDrive1.SearchList(xCloudFolder, true, nil);
              xSkyFolder := TSkyDriveItem(TMSFMXCloudSkyDrive1.Drive.Items[0]);

              // FILE
              xSkyFile := TSkyDriveItem.Create(nil);
              TMSFMXCloudSkyDrive1.SearchList(xCloudFile, true, xSkyFolder);
              xSkyFile := TSkyDriveItem(TMSFMXCloudSkyDrive1.Drive.Items[0]);
              TMSFMXCloudSkyDrive1.Download(xSkyFile, xTargetFile);

Posted By: Bart Holvoet
Date Posted: 21 Mar 2019 at 3:11pm
- GDrive: There is no folder path required in the SearchFile function.

- SkyDrive: You can use the result of the SearchList call instead of the Drive collection. 

  xSky: TSkyDriveItem;
  SkyItems: TCloudItems;
  xSky := TSkyDriveItem.Create(nil);
  SkyItems := AdvSkyDrive1.SearchList(Edit1.Text, True, nil);
  xSky := TSkyDriveItem(SkyItems.Items[0]);

Note if the problem persists you can check in your code if the search function has returned the result(s) you expected to find out if the search query was correct.

Posted By: Marc SPRIT
Date Posted: 31 May 2019 at 11:27pm
Have you samples to download and upload specific file (folder + filename without treeview) with Dropbox, OneDrive and Google Drive ?

Posted By: Cristea Gabriel
Date Posted: 01 Jun 2019 at 7:51pm
Nope, i can not manage to do this with no involving treeview :(

Posted By: Marc SPRIT
Date Posted: 01 Jun 2019 at 11:18pm

I regret the purchase of these components, they are unusable without adequate documentation. I will look for another provider who will bring more help

Print Page | Close Window