Just for poops and smiles, add the 'nameconflict' parameter to the CFFILE tag and set it to makeUnique, and use serverFile as the file name in case it is renamed on conflict.
If that fails, let me know. I'll keep thinkin' on it.
Thank you for your answer, however I am using cffile action="copy" and not cffile action="upload", so I don't think this nameConflict parameter is available here.
There might be issues with concurrent access at the source file as well as at the destination file. The commonest issue with the source file is when one request attempts to read it while a second request is writing it. With the destination, an issue may arise if two separate requests attempt to copy or write to the same file.
You could use a try-catch and lock to handle both cases. The try-catch ensures that the code will continue to run even if the copying results in an error. The lock prevents two separate processes from simultaneously accessing a file.
<cfset isImageCopied = fileExists("#DEMrepert#/BIB/#NomImageHD#")>
<cflock name=“imageCopyLock” type=“exclusive” timeout=“10”>
<cfif NOT isImageCopied>
<cffile action="copy" source="#BIBrepertHD##NomImageHD#" destination="#DEMrepert#/BIB">
<!--- Log the fact that something went wrong during copying --->
If the source file is created elsewhere, then put that code within a lock of the same name:
<cflock name=“imageCopyLock” type=“exclusive” timeout=“20”>
<!--- Code that creates the file at the location #DEMrepert#/BIB/#NomImageHD# --->
Thank you very much for this idea.
I have implemented it and I will check how it is behaving with it.
As it was intermittent issue, I will monitor this during few days before knowing if it works..
De : BKBK
Envoyé : vendredi 22 avril 2016 16:37
À : Pierre THES
Objet : Coldfusion 11 - java.nio.file.FileSystemException on cffile copy
Coldfusion 11 - java.nio.file.FileSystemException on cffile copy