i built function where user can upload an image but i have problem with deleting Image from webserver after using it in image component. The image locked by java.exe
I have use os.remove, but access denied.
delete it in from windows folder, same result.
how can i delete file or image from webserver without restarting the gateway.
FYI, i put all my image on the webserver folder, since i need to expose all document and images to the perpsctive client.
This is Perspective?
Thanks. I added the tag to your post
You'll need to unblock the file, i've posted some tools to do this here
There is an issue with java locking files that are in use. Mainly when using the webserver.
Causing it to be impossible to delete them while the gateway is running.
But here is a solution! (For windows atleast). Using handle you can find and unlock files.
I made it a bit easier to use by writing a simple bat file.
UnlockAndDelete.zip (891.3 KB)
Unzip on the pc in the gateway (in for example C:\Folder)
You can execute this through script or in the cmd line, requires admin rights!
Thanks for the reply, but, is there an option to use internal ignition scripting instead of using another application which can lead to inconsistent behavior?
You can trigger the script from inside igntion, but it does require the bat file/ windows handle that is also in the zip folder.
I dont know if there are other ways than using handle. Its been a while that i made the post, but i had to search quite a while before i found somthing that worked. As far as i found Java has no way to unluck the file. Its a windows thing
Using the webserver folder to host files is
not supported, in part because this java behavior cannot be changed.
Use the WebDev module to serve arbitrary files.
If you have the option to store your images as "blobs" in a database, you could use my free Blob Server module instead.