45 lines
1.5 KiB
HTML
45 lines
1.5 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<title>Test Upload with Logging</title>
|
||
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<h1>Test Upload with Logging</h1>
|
||
|
|
|
||
|
|
<form id="uploadForm" enctype="multipart/form-data">
|
||
|
|
<input type="hidden" name="module" value="Documents">
|
||
|
|
<input type="hidden" name="action" value="SaveWithLogging">
|
||
|
|
<input type="file" name="filename" accept=".txt,.doc,.docx,.pdf">
|
||
|
|
<input type="hidden" name="notes_title" value="Test Upload">
|
||
|
|
<input type="hidden" name="assigned_user_id" value="1">
|
||
|
|
<button type="submit">Upload File</button>
|
||
|
|
</form>
|
||
|
|
|
||
|
|
<div id="result"></div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
$(document).ready(function() {
|
||
|
|
$('#uploadForm').on('submit', function(e) {
|
||
|
|
e.preventDefault();
|
||
|
|
|
||
|
|
var formData = new FormData(this);
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: 'index.php',
|
||
|
|
type: 'POST',
|
||
|
|
data: formData,
|
||
|
|
processData: false,
|
||
|
|
contentType: false,
|
||
|
|
success: function(response) {
|
||
|
|
$('#result').html('<div style="color: green;">Success: ' + JSON.stringify(response) + '</div>');
|
||
|
|
},
|
||
|
|
error: function(xhr, status, error) {
|
||
|
|
$('#result').html('<div style="color: red;">Error ' + xhr.status + ': ' + xhr.responseText + '</div>');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|