Skip to main content
Mar 11, 2011 9:53 AM UTC
Question

Issue with copyTo function in FMS 4

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 is closed to new replies. Start a new post to keep the conversation going.

    13 replies

    Inspiring
    Oct 19, 2012 8:20 AM UTC

    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.

    Translate
    Mar 11, 2011 10:21 AM UTC

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

    Translate
    Mar 11, 2011 10:30 AM UTC

    Thanks for your quick reply,

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

    Translate
    Mar 11, 2011 10:46 AM UTC

    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?

    Translate
    Mar 11, 2011 10:13 AM UTC

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

    Translate