Posts: 83
Threads: 23
Joined: Feb 2022
Reputation:
1
Location: Melbourne
02-09-2022, 03:25 AM
(This post was last modified: 02-09-2022, 07:37 PM by rlebeau.)
I'm adding temp files using something like:
sTempFileName := TIWAppCache.StreamToCacheFile(self, ...
And sTempFileName works fine as a URI (i.e.: in a IWURLWindow1.URI), because it's a valid relative URI.
But I need to get a local absolute path to this file in the server-side code, hopefully easier than parsing WebApplication.UserCacheDir, etc.
Is there a direct way of doing this?
Posts: 83
Threads: 23
Joined: Feb 2022
Reputation:
1
Location: Melbourne
Actually, this may not be very reliable, because these .tmp files have internal caching data appended to them. So I'll need to reshuffle all this anyway.
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
Correct, they do have info in them.
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
The source code can offer you a stream from them though and it removes the extra info if you can use a stream instead of a file itself.
Posts: 2,299
Threads: 202
Joined: Mar 2018
Reputation:
87
Location: Auckland, New Zealand
There is a rule of thumb with the cache system: once you add something to the cache, you should just forget about it... :-)
It doesn't belong to you anymore. The cache file is not only the data that you put in there. It is your data + some metadata containing important information about the cache file itself.
Can you please explain why do you need to read the cache file after you saved your own data to it? Wouldn't be easier to read/store this data before adding it to the cache?