Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Community Beginner ,
Apr 30, 2025 Apr 30, 2025

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.

530
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , May 01, 2025 May 01, 2025

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.

Translate
Community Expert ,
Apr 30, 2025 Apr 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2025 Apr 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2025 Apr 30, 2025

Are you using ColdFusion's Virtual File System(VFS)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2025 Apr 30, 2025

I don't believe so, no.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2025 Apr 30, 2025

Scratch, that. Yes, that option is enabled in the CF Admin.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2025 Apr 30, 2025

To be clear, is "\\srv-cfdev\stcnet1\branchcontrol\files" a path on file system (for example, by means of a mapping srv-cfdev), a UNC network path or a path in the Virtual File System (ram://)?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2025 Apr 30, 2025

It's a network path.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2025 Apr 30, 2025

That might explain the difference:. Could it be that the path is defined in Production, but not in Development?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2025 Apr 30, 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2025 Apr 30, 2025

I think you're right. Until now, I was going by your message 'file upload error "Error occurred while copying the file from source"'. After your last post I took another look at the attachment in your initial post.

 

There the error is clearly "Access Denied". You could therefore conclude that the PDF is uploaded, but ColdFusion's uploader does not have (network) access to the file. 

 

First guess: check to make sure ColdFusion has suffcient Active Directory permissions.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2025 Apr 30, 2025

So, I'm just following up here, and am not an expert with VFS in ColdFusion. @BKBK noted that it looked like you had it enabled, because the last line of your error dump references it. But this file path is not using VFS, which had me scratching my head. My guess would be that @BKBK is right and that the CF user account doesn't have permissions to read and write to it. By default, the CF user account is actually a security context, LocalSystem or SYSTEM, that has full privileges to the local machine but absolutely no privilege to network resources at all. So, check that out in your Services control panel. I'm not sure why VFS is coming up here, but it's in your error message.

 

Dave Watts, Eidolon LLC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2025 May 01, 2025

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>
    ​

     
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 01, 2025 May 01, 2025

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2025 May 01, 2025
LATEST

Thanks for the update and for sharing the solution.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources