75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
@page
|
|
@model ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel
|
|
@{
|
|
ViewData["Title"] = "File Upload";
|
|
}
|
|
|
|
<h1>Upload File</h1>
|
|
@* <form asp-page-handler="Upload" id="1" method="post" enctype="multipart/form-data">
|
|
<div>
|
|
<label asp-for="File">Choose a file:</label>
|
|
<input asp-for="File" type="file" required>
|
|
</div>
|
|
<button type="submit">Upload</button>
|
|
</form> *@
|
|
|
|
<form asp-page-handler="ShiftDate" id="8" method="post">
|
|
|
|
<button type="submit">افزودن شیفت دیت</button>
|
|
</form>
|
|
|
|
<form asp-page-handler="ShiftDateNew" id="9" method="post">
|
|
|
|
<button type="submit">ست شیفت 1 </button>
|
|
</form>
|
|
<form asp-page-handler="ShiftDateNew2" id="10" method="post">
|
|
|
|
<button type="submit">ست شیفت 2 </button>
|
|
</form>
|
|
|
|
|
|
@if (ViewData["message"] != null)
|
|
{
|
|
<p>@ViewData["message"]</p>
|
|
}
|
|
|
|
@* <script>
|
|
|
|
$(document).ready(function () {
|
|
$('#fileUploadForm').submit(function(e) {
|
|
e.preventDefault(); // Prevent the default form submission
|
|
|
|
// Create FormData object
|
|
var formData = new FormData();
|
|
var fileInput = $('#FormFile')[0]; // Use the first element of the jQuery object
|
|
|
|
// Check if a file was selected
|
|
if (fileInput.files.length === 0) {
|
|
alert("Please select a file!");
|
|
return;
|
|
}
|
|
|
|
// Append the file to the FormData object
|
|
formData.append('file', fileInput.files[0]);
|
|
|
|
$.ajax({
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
processData: false, // Prevent jQuery from automatically transforming the data into a query string
|
|
contentType: false, // Tell jQuery not to set the content type
|
|
url: `@Url.Page("./index", "Upload")`,
|
|
headers: {
|
|
"RequestVerificationToken": `@Html.AntiForgeryToken()`
|
|
},
|
|
data: formData,
|
|
success: function(response) {
|
|
alert("File uploaded successfully!");
|
|
},
|
|
error: function(err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
</script> *@ |