I am new to JavaScript. I need to move a file to another directory using JavaScript. How can simply move that file with JavaScript?
How can I solve this?
I
As far as I understand the problem which you're trying to solve is to create some kind of rich UI (user interface), where user can drag-and-drop files through directory tree.
Well that's is surely possible, but the way to make it right - and with that I mean make it cross-browser compatible and secure - is with a serverside script (PHP, ASP.Net, whatever) running behind it, providing all the data and file-system operations, with a security layer on top of it.
And if you want an unsecure, MS Internet Explorer only solution - sure you can use ActiveX objects.
Tried this code, working perfectly :
function moveFile(){
var object = new ActiveXObject("Scripting.FileSystemObject");
var file = object.GetFile("C:\\wamp\\www\\phptest.php");
file.Move("C:\\wamp\\");
document.write("File is moved successfully");
}
In your code, issue seems to be in file path "./Docus/". Try to put absolute path and then check.