How can I move a file to other directory using JavaScript?

前端 未结 2 697
星月不相逢
星月不相逢 2021-01-15 01:02

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

2条回答
  •  旧巷少年郎
    2021-01-15 02:01

    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.

提交回复
热议问题