<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>EasyUI Multi-File Upload</title>
<link rel="stylesheet" type="text/css" href="/ajax/libs/jquery-easyui/1.9.15/themes/default/">
<script src="/jquery-3.6."></script>
<script src="/ajax/libs/jquery-easyui/1.9.15/"></script>
</head>
<body>
<h2>EasyUI Multi-File Upload</h2>
<form id="fileUploadForm" method="post" enctype="multipart/form-data">
<input id="filebox" name="files" type="file" class="easyui-filebox" data-options="multiple:true" multiple="multiple">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="uploadFiles()">Upload</a>
</form>
<script>
function uploadFiles() {
$('#fileUploadForm').form('submit', {
url: '/upload',
onSubmit: function() {
// Do some validation before submitting if needed
return $(this).form('validate');
},
success: function(data) {
// Handle the server response here
// Assuming server returns JSON
var response = (data);
if () {
$.('Success', 'Files uploaded successfully');
} else {
$.('Error', );
}
},
error: function(response) {
// Handle errors here
$.('Error', 'Failed to upload files');
}
});
}
</script>
</body>
</html>