Can't figure out how to 'free up' a file after it is destination of MBS CURL download

Windows 8.1; Xojo 2015r1

This is the set up…

This works fine the first time. I make a copy of this file, then I connect to the copy (it is an sqlite database)

The problem happens the next time I call this routine - say 3 minutes later.

I get an IOException during this statement: b = BinaryStream.Create(CloudCopy, true)

Was originally getting system error 104, then after trying some things getting system error 32 - both seem to indicate I do not have permission to mess with this file.

What can I do to regain overwrite access to this file? I even tried to delete the file right after I used it (copied it for use as a different file), but something keep hanging on to its permissions.

Any ideas?

My guess is that the file is still open from the previous call. Make sure you are closing the BinaryStream once you’re finished with it.

Hi Mark … I had a similar problem last year when I first starting using MBS CURL for downloads … it was driving me nuts. The issue turned out to be caused by the server caching the file after the first access attempt. Christian Schmitz had me set the HTTP Header array option setting to indicate “Cache-Control: no-cache” … d.SetOptionHTTPHeader array("Cache-Control: no-cache") … problem solved. Not sure if that’s your issue or not, but sure sounds similar … worth a try.

… Don

[code] // download the image file(s)
dim e as integer
dim d as DownloadCURL
dim URL As String
dim dest As FolderItem
dim b as BinaryStream

URL = “
d=new DownloadCURL
d.b = b
d.OptionURL = URL
d.SetOptionHTTPHeader array(“Cache-Control: no-cache”)

So far this direction is looking promising.

Don - thanks for that info, that may come in handy as well.