[File Transfer Plugin] Nothing happening when clicked to download

Forge Component
(8)
Published on 2019-12-18 by Experts
8 votes
Published on 2019-12-18 by Experts

Hi

I have made a button  which I have connected to an action to download a pdf using File Transfer plugin.


I have followed all the steps given in the demo. 

Url : 

File in resource folder: 


BUT still I am getting error.

Hello Shubham,

It seems to be a problem with the filePath variable.

What are the values that you are using for iOS and Android?


Kind regards,

Rui Barradas

Rui Barradas wrote:

Hello Shubham,

It seems to be a problem with the filePath variable.

What are the values that you are using for iOS and Android?


Kind regards,

Rui Barradas

Hi Rui 

I am using the same value as given in demo.


For Ios: $parameters.FilePath = cordova.file.tempDirectory;

for android: $parameters.FilePath = "Documents/";

Hello Shubham,


I think that the problem is in this statement: $parameters.FilePath = cordova.file.tempDirectory;


I have it working and I defined these following paths (according to the given directories):

For iOS: $parameters.FilePath = "tmp/"; (Temp Directory)

For Android: $parameters.FilePath = "Documents"; (Documents Directory)


Can you please make these changes and try out again?


Kind regards,

Rui Barradas

Rui Barradas wrote:

Hello Shubham,


I think that the problem is in this statement: $parameters.FilePath = cordova.file.tempDirectory;


I have it working and I defined these following paths (according to the given directories):

For iOS: $parameters.FilePath = "tmp/"; (Temp Directory)

For Android: $parameters.FilePath = "Documents"; (Documents Directory)


Can you please make these changes and try out again?


Kind regards,

Rui Barradas

Hi Rui

I have applied the changes suggested by you. But still it is nit saving. It is showing error while processing your request.






The pathvalue and url I am using.


Thanks and Regards

Shubham Agarwal

Solution

Hello Shubham,

So basically we decided to do a Skype call to address the problem and it worked afterwards.


Here's a summary:

  • The goal was to download a file and open it in the device. The file was stored in the Resources folder of the eSpace.
  • To achieve this, we decided to use the File Plugin. The SaveFile client action allows to save a file into a specific directory.

                                                                 

  • This action receives the BinaryData and the Path as input parameters. Since the file was uploaded to the Resources folder, we had no problem accessing to its binary content.

                                                       

  • After, we defined the Path parameter according to the device platform (iOS or Android)

            For iOS: $parameters.FilePath = "tmp/"; (Temp Directory)

            For Android: $parameters.FilePath = "Documents"; (Documents Directory)

  • Finally, we used the OpenDocument client action from the File Viewer Plugin to open the document in the device, using the URI output parameter from the SaveFile action as an input parameter.

                                           



Kind regards,

Rui Barradas

Solution

Rui Barradas wrote:

Hello Shubham,

So basically we decided to do a Skype call to address the problem and it worked afterwards.


Here's a summary:

  • The goal was to download a file and open it in the device. The file was stored in the Resources folder of the eSpace.
  • To achieve this, we decided to use the File Plugin. The SaveFile client action allows to save a file into a specific directory.

                                                                 

  • This action receives the BinaryData and the Path as input parameters. Since the file was uploaded to the Resources folder, we had no problem accessing to its binary content.

                                                       

  • After, we defined the Path parameter according to the device platform (iOS or Android)

            For iOS: $parameters.FilePath = "tmp/"; (Temp Directory)

            For Android: $parameters.FilePath = "Documents"; (Documents Directory)

  • Finally, we used the OpenDocument client action from the File Viewer Plugin to open the document in the device, using the URI output parameter from the SaveFile action as an input parameter.

                                           



Kind regards,

Rui Barradas

Thanks Rui for all the support and patience.


No problem Shubham. Cheers mate :)