Downloading UserFiles via JavaScript
The following example shows how you can download UserFiles automatically using
JavaScript. Replace the URL of the example by the correct IP address of the interface of
your CPU at this URL and use the appropriate transfer protocol (HTTP or HTTPS).
<html>
<head>
<title>UserFiles JavaScript Test</title>
<script type="text/javascript" src="jquery-
1.11.2.min.js"></script>
</head>
<body>
<h1>UserFiles JavaScript Test</h1>
<div><button id="load">Load UserFiles</button></div>
<table
border="1"><thead><th>Name</th><th>Operation</th></thead><tbody
id="list"></tbody></div>
<div><form method="POST"
action="http://192.168.2.132/UserFiles?Action=UPLOAD&E=1"
enctype="multipart/form-data"><input type="file" name="File"
/><input type="submit" /></form></div><br>
<script type="text/javascript">
function(data){
$('#list').append('<tr><td>'+decodeURIComponent(data[0])+'</td><td><
a href="http://192.168.2.132'+data[1]+'">Download</a><br><button
type="button"
onclick="Delete(\''+data[2]+'\')">Delete</button></td></tr>');
</script>
</body>
</html>
Web server
Function Manual, 11/2019, A5E03484625-AG
function Delete(url) {
$.post('http://192.168.2.132/UserFiles' + url, {}, function(){
$('#load').click();
});
}
$('#load').click(function(){
$('#list').empty();
$.get('http://192.168.2.132/UserFiles', {'Action': 'LIST'},
$.each(data.split(/\r\n/), function(){
var data = this.split("|");
if (data.length == 3)
});
});
});
Web pages
3.15 User files
119