File.CopyTo only works in same directory
When a user unpublishes a stream I want to take the recorded file and move it to a different location on our server. I can only get the File.CopyTo to work when it's in the same directory and i'm not sure why; and the error thrown is useless.
The following code is the only copy I can get working.
application.onUnpublish = function (clientObj, streamObj) {
var myFile = new File("streams/" + streamObj.name + "/" + streamObj.name + ".flv");
if (myFile.copyTo("/streams/" + streamObj.name + "/" + streamObj.name + "meow.flv")) {
trace("Copy completed");
}
}
I've tried provided the full paths like C:\a\custom\dir but it never works.
Error I keep getting:
Sending error message: C:\Program Files\Adobe\Flash Media Server 4.5\applications\myapp\main.asc: line 77: Error: File operation copyTo failed.
code: Application.Script.Error level: error
Application.Script.Error details: C:\Program Files\Adobe\Flash Media Server 4.5\applications\myapp\main.asc: line 77: Error: File operation copyTo failed. <-- Line 77 is myFile.copyTo(...)
