Sign In Register

How can we help you today?

Start a new topic
Answered

How to retrieve downloadable file data?

Hi. 

I uploaded a text file with hello.txt. which contains "hello" and i want to display like this.

Spark.setScriptData("name", filedata)


Best Answer

Hi Rajababu,


If you upload your file as Jon you can get it with SparkFiles uploadedJson method. Example below.


 

//contents of test json file

{
"test":"value",
"test2":"value2"
}

//In Cloud Code
var reader = Spark.getFiles().uploadedJson("c462bdfe7cd0481ab1dd391f2610494a");
Spark.setScriptData("result", reader)

 

This should return the data from the json file in scriptData. What exactly are you trying to do here ? 


Thanks,

Liam



1 Comment

Answer

Hi Rajababu,


If you upload your file as Jon you can get it with SparkFiles uploadedJson method. Example below.


 

//contents of test json file

{
"test":"value",
"test2":"value2"
}

//In Cloud Code
var reader = Spark.getFiles().uploadedJson("c462bdfe7cd0481ab1dd391f2610494a");
Spark.setScriptData("result", reader)

 

This should return the data from the json file in scriptData. What exactly are you trying to do here ? 


Thanks,

Liam



Login to post a comment