Example Program HTTPdownloader Downloads Link NOT the File

I was looking for a simple way to download a file (actually just some text) and looked at the example program HTTPdownloader and thought that would work just fine. I could craft something more complex using the FTP server on my Web Server but that seemed to be more than I needed.

I created a text file on my Web Server with a .TXT extension and tested the URL and the browser shows the text in the file as I expected.

When I run the example Xojo program I get HTML output and a link to the file in the file downloaded to the desktop (default location in the example program).

I thought this should download the actual file contents of the specified file. What have I missed?

Thanks.

Testing the example with the answers disk image I’m having a successful result. It may be your web server responding with a HTML file, especially if you’re using Dropbox as a test.

Tim,

Thanks for the quick reply.

When I try the URL with a “real” browser the display shows the content of the text file as expected and not a link. You are probably right that the Web Server is what is causing it to be a link. This is a Windows server with the Abyss Web Server and not Dropbox.

It could be the RequestHeaders in the HTTPsocket. I will have to see if I can figure out what to add that will make my Web Server download the file and not a link.

Mark

Instead of HTTPSocket, you might also want to try Xojo.Net.HTTPSocket which might follow redirects for you. Also since it looks like you’re in the Beta you might want to take a look there as well.

Paul,

OK … I cannot get the new Xojo.Net.Httpsocket to compile because it requires the new framework … and I am to dense to make the jump to the new Xojo.IO.Folderitem.

ALSO … “in the Beta” … not sure what you mean by that.

I give up … off to use MBS Curl to download my file.

Mark

You have “Pre-Release Testers” listed next to your name here on the forum. That would indicate you can click on the “Pre-Release” channel at the top of the forum to try the Betas.

Ahhhhh … or as Homer Simpson would say … Doh

Do you think the pre-release would have a working HTTP download sample program with the new framework (Net.Xojo.HTTPsocket)?

I am not prone to installing Xojo pre-released versions but it would be worth it if there was a new sample program.

Thanks, Mark