Browser download no longer working

I believe I need to convert a folder item to a webfile to enable it for browser download. Code below shows relation between OUTFILE (a folderitem) and ReportFile (a webfile).

I am trying to have the browser download the file for the user. For DEBUG I am saving OUTFILE to my desktop prior to assigning it to REPORTFILE for download.
The download fails because of the unusual URL associated with REPORTFILE - this used to work, but no longer does, and I can not figure out why.
Please help.

Outfile Path shows: file:///C:/Users/marka_000/Desktop/TestDoc.pdf
Reportfile Path shows: http://127.0.0.1:8080/44059982DAA84BE84A01BE69346EE947/files/{3703-6754-3451-7626-5047}/TestDoc.pdf
Browser error message: The requested URL “/44059982DAA84BE84A01BE69346EE947/files/%7B3703-6754-3451-7626-5047%7D/TestDoc.pdf” could not be found. Please check your request and try again.

Why the difference?


Dim OUTFILE As FolderItem = SpecialFolder.Desktop.Child(“TestDoc.pdf”)

Dim ReportFile As WebFile
If OUTFILE <> Nil And OUTFILE .Exists Then
ReportFile = WebFile.Open(outfile)
MsgBox "OUTFILE Path: "+outfile.URLPath+EndOfLine+"REPORTFILE Path: "+ReportFile.URL
End If

ShowURL(ReportFile.URL) // Download the file

When you create the WebFile, you need to hold onto a reference for it, and release it once it’s downloaded. One approach is to keep an array of downloads in progress as a property of your Session class. Periodically loop through that array and remove items that have been downloaded.

Darn! I completely forgot about that.
Thanks!

Is there an Event to tell you that the download has completed? I thought the WebFile was handed to the web server to download and Xojo no longer tracked it.

That was my impression as well - so I assume Brad’s guidance suggests to assume the task in underway and will be completed once the WebFile.Downloaded event occurs.

Yes, that.