[Help] How to Free/Unlock the DownloadStream Resource??

I try to display serval Images in an Popout Windows, those image files are loaded from external folder through
“FileResource” class, which works fine.
Because Image file name cannot be change. so new file need to overwrite the existing one. so if user open the image page and re-upload the image to overwrite the existing file will raise IOexception.

So far, I try to override the FileResource class to close InputStream, replace the source. still getting the same error: File cannot be modified.

Anyone have idea, how to safely replace the file open by FileResource class?

Any suggestion will be appricated. Thanks!


Instead of using a FileResource, how about
? That’s more suited for dynamic content. You can still read the file on load and save a new file on uploads, but then you won’t be so married to the actual copy on the physical drive.


Thanks lot Olli Tietäväinen ~
Accroding to your suggestion, I made a new copy, already workaround this issue.

Nice to hear!