HTML script to move a file on Raspberry Pi

35 Views Asked by At

On a raspberry pi I'm running a web-application in which a user needs to fill a table and submit the input. This data goes in a CSV file which is stored (by default) in the downloads folder.(/home/pi/dowloads/data.csv). I need to use the information and therefor the file data.csv should be in another folder, namely: /home/pi/Werk/ Currently I'm trying to move this file with a button on one of the webpages and wrote the following HTML script

`<button onClick="move()">Move File</button>

<script type="text/javascript">

function move() 
            {
                var object = new ActiveXObject("Scripting.FileSystemObject");
                var file = object.GetFile("home/pi/Downloads/data.csv");
                file.Move("home/pi/Werk");
                console.log("File is moved successfully");
                }`

both file paths are as shown in the file explorer on the raspberry pi.

Until now whatever I do the file data.csv is in the Downloads folder and stays there. Can somebody show me what I'm missing

I have changed the path description in the HTML script. And also placed the file in other places. Expecting that with another path the file should be moved on click

0

There are 0 best solutions below