Download from the server doesn't work

I am trying to download a file using the code from the Xojo documentation.
This only works locally, if I run this from the xojo.cloud server nothing happens.
What do I miss?

wf = New WebFile
wf.MIMEType = “application/pdf”
wf.ForceDownload = True
wf.FileName = "wijkbus " + dt + “.pdf”
wf.Data = d.ToData

Session.GoToURL(wf.URL)

Check this example:
https://documentation.xojo.com/api/web/webfile.html#webfile-download

1 Like

Thank you Ricardo,
but I get the same result. Local it works, on the server no reaction!

Ouch, what Xojo version are you using?, what’s the OS and version of the server?

os 12.6, xojo 2022 release 2, server xojo.cloud

The problem is calling GoToURL…

Have you tried this instead? https://blog.xojo.com/2022/05/31/how-to-download-and-preview-pdfs-in-xojo-web-apps/

1 Like

There I started. Same problem, the html page was not shown.

Ok. So maybe the problem is related with fonts? Are the fonts used installed in Xojo Cloud? I suggest you to contact @Jason_Parsley so he can check that everything is ok in the server side.

For example you may try to just deploy to Xojo Cloud the example from the blog post and see if it works as is. If it doesn’t probably your Xojo Cloud instance will need the installation of a couple of extra libraries and the by default fonts…

1 Like

I will do that, thanks.

1 Like

Hi Herman - I’m going to email you an example project that is working on my Xojo Cloud server.

1 Like

Your example works. But it is with a textfile. I try to download a pdf-file and that doesn’t work.

Just out of curiosity, where is wf defined?

Ok, it’s good to see that the text example is working for you. It looks like the problem is what Javier mentioned above - a pdf lib is missing. I will contact you once that is installed and that should fix this.

wf is a property of the webpage.

Jason, I wait for your solution, “hello world” is not the report I want to download.

1 Like

Solved by Jason. Javier you were right. Thanks!

3 Likes