Skip to main content
Inspiring
April 30, 2025
Answered

file upload error "Error occurred while copying the file from source"

  • April 30, 2025
  • 1 reply
  • 2042 views

I'm getting an error while trying to upload files. This works fine on our Production server, but the development server is where I'm getting the error.

 

Both servers are running Coldfusion 2023 Update 13 on Windows Server 2022. Attached is an example of the error I'm getting. I'm unsure what to check for here.

    Correct answer presuhn1111

    Hi @presuhn1111 ,

    Here is a suggestion for a test. It is to check whether file-access-permissions are indeed the cause of the issue.

    1.  Store a test file, test.pdf, within the current directory.
    2.  Run the following code in a CFM file.
    3.  Verify whether the file is copied.
      <cftry>
      	<cfset source = expandPath('.') & '\' & 'test.pdf'>
      	<cfset destination = "\\srv-cfdev\stcnet1\branchcontrol\files\testCopy.pdf">
      	<cfset filecopy(source, destination)>
      	
      	Does destination file exist? Answer: <cfoutput>#fileExists(destination)#</cfoutput>
      	
      	<cfcatch type="any">
      		<cfdump var="#cfcatch#">
      	</cfcatch>
      </cftry>
      ​

       

    Thank you everyone for your help. It ended up being a folder sharing permission issue. I'm not the 'server guy' so he had to tinker with it to get it working.

    1 reply

    BKBK
    Community Expert
    Community Expert
    April 30, 2025

    The cause of the problem is likely to be the attribute:

    destination="#application.files#"

    The destination attribute must be a path to a directory. However, the value is currently a path to a file.

    Inspiring
    April 30, 2025

    #application.files# is a variable with a value of \\srv-cfdev\stcnet1\branchcontrol\files\ which is a directory. hard-coding the directory path gives the same result.

    BKBK
    Community Expert
    Community Expert
    May 1, 2025

    Nope. I mean, the path is different on production, the only difference is the server name. (srv-intranet vs srv-cfdev). Otherwise, they're exactly the same. CF Admin settings are all the same, so I'm leaning towards this being a server permissions issue. 


    Hi @presuhn1111 ,

    Here is a suggestion for a test. It is to check whether file-access-permissions are indeed the cause of the issue.

    1.  Store a test file, test.pdf, within the current directory.
    2.  Run the following code in a CFM file.
    3.  Verify whether the file is copied.
      <cftry>
      	<cfset source = expandPath('.') & '\' & 'test.pdf'>
      	<cfset destination = "\\srv-cfdev\stcnet1\branchcontrol\files\testCopy.pdf">
      	<cfset filecopy(source, destination)>
      	
      	Does destination file exist? Answer: <cfoutput>#fileExists(destination)#</cfoutput>
      	
      	<cfcatch type="any">
      		<cfdump var="#cfcatch#">
      	</cfcatch>
      </cftry>
      ​