I was working with FMS 3.5 and using the function 'copyTo()' to copy a file to a desired location.
store is a virtual directory defined in Application.xml file in the server side and name is a variable that stores the fileName without extension
This was working fine with FMS 3 and FMS 3.5.
Now, I moved to FMS 4 and noticed that this copyTo() function is not working.
In the FMS Admin Console, it throws an error:Error: File operation copyTo failed.
Can anyone please help me in solving this issue.
Thanks in advance...
The following is my Application.xml file, where I define the virtual directory:
The Application.xml part which you have pasted here looks like from 3.5. Are you using same configurations files which were used in 3.5 in 4.0 installation.
I am saying this based on what you have pasted - <JSEngine> tag is replaced by <ScriptEngine> now.
Oh, I see...
I changed it, but still the same error.......
New Application.xml is as follows:
FMS 4 has stronger security settings and one of them includes FMS Administrators needing to enable virtual directories for the scripting file object. It's possible that this setting is NOT enabled for your installation, and the warning in the core logs has not been observed - please check Server.xml for
"VirtualDirectoryForFile" configuration - this will need to have enable=true to allow this setting to operate.
LMK if this helps the situation.
Earlier itself I had tried enabling "VirtualDirectoryForFile" configuration in the Server.xml file; but I didn't help.....
So, I changed the logic of copying the file. I wrote a PHP script to do so.....
Anyway, thanks to all for your inputs........
Hi, I have a similar problem. Here's my code:
var source = new File(src);
var destination = new File(dst);
source.copyTo( destination );
This does not work even if destination is in the same directory.
Absolute paths also don't work, as well as relative paths.
I'm using a stock Amazon EC2 FMS.
Could you please help me? I want to avoid using cgi and external programs.
Can we at least know why it failed? Because the error message is not really helpful:
2012-06-15 11:22:22 29348 (e)2641173 Sending error message: /mnt/applications/livepkgr/main.asc: line 9: Error: File operation copyTo failed. -
Did it failed to open a the source for reading? Did it failed to open destination for writing? Did it failed to find source file? How can I know it?
Is there a debugger apart from "trace" for server side actionscript?
You are missing one more configuration setting to get this to work.
There are two settings, the first one is the one you already found, the VirtualDirectoryForFile in the Server config.
But there is another one in the vHosts Application.xml:
In there, there is also a FileObject element, with the attribute override="no"
This denies any settings you might put into your applications Application.xml.
If you set the attributes value to "yes", everything will work like you want it to.
Europe, Middle East and Africa