Skip navigation
Currently Being Moderated

Issue with copyTo function in FMS 4

Mar 11, 2011 1:53 AM

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

 
Replies
  • Currently Being Moderated
    Mar 11, 2011 2:21 AM   in reply to J_hari

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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2011 2:46 AM   in reply to J_hari

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2011 10:11 PM   in reply to J_hari

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2011 1:24 PM   in reply to J_hari

    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.


    Asa

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 15, 2012 8:34 AM   in reply to Asa - FMS

    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?

     

    Thank you

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 27, 2012 1:15 AM   in reply to paulo_fms

    It's fileObject.copyTo (name);

    destination is a "name" and not a file object.

     

    But anyway, I met the same error message as said (Error: File operation copyTo failed.)

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2012 1:20 AM   in reply to J_hari

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points