Download file to local drive

I have written a Server Action which:

  • checks to see if a directory exists (C:/OutSystems/data)
  • if the directory does not then it creates the directory
  • after the directory has been created I have used the "File_AppendText" to write text to a file (junk.txt)

I think this is all working correctly but I do not know since I cannot get to the server to verify.

I have written a Screen Action that is to download the file created in the Server Action.  In the Screen Action I am using the "Download Widget".  The download widget has the following properties:

  • File Content:
  • File Name: "C:/OutSystems/data/junk/txt"
  • Mime-Type: "application/octet-stream"

I do not know what to put for the File Content, can anyone show me what the "File Content" needs to be?

Solution

Hi Curtis,

The file content field receives a binary file. What you should do is to use the TextToBinary method and the output of this method pass to the Download widget.

Something like what follows:

Let me know if you have any question,

Cheers,

RG

Solution

I have added the BinaryData => TextToBinaryData.  Since I am dealing with a file, what do I put for the text Property of the TextToBinaryData Server Action?

Thanks, I was able to get it to work!!!

Curtis Muhlestein wrote:

I have added the BinaryData => TextToBinaryData.  Since I am dealing with a file, what do I put for the text Property of the TextToBinaryData Server Action?

This solution is given by Ruben G. Credit goes to him, please