Skip to main content
March 11, 2011
Question

Issue with copyTo function in FMS 4

  • March 11, 2011
  • 3 replies
  • 2976 views

I was working with FMS 3.5 and using the function 'copyTo()' to copy a file to a desired location.

Code: fileObject.copyTo("store/"+name+".flv")

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

    This topic has been closed for replies.

    3 replies

    Inspiring
    October 19, 2012

    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.

    March 11, 2011

    try   fileObject.copyTo("/store/"+name+".flv")

    March 11, 2011

    Thanks for your quick reply,

    I tried fileObject.copyTo("/store/"+name+".flv"), but it didn't work...

    March 11, 2011

    hmm

    It's  strange. In my code copyTo works fine in FMS3.5 & 4.01.

    Is fileObject closed? Does FMS have permissions to write into 'store' directory?

    March 11, 2011

    Update:

    The following is my Application.xml file, where I define the virtual directory:

    <Application>
    <JSEngine>
            <FileObject>
                <VirtualDirectory>/store;D:\Program Files\MyFiles\FMS\RecordFiles\Videos</VirtualDirectory>
             </FileObject>
    </JSEngine>
    </Application>

    Thanks...