generated from dwd/boilarplate-astro-tailwind
deffiine path
This commit is contained in:
57
src/pages/editor/ad-file.astro
Normal file
57
src/pages/editor/ad-file.astro
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
import Layout from "../layouts/Layout.astro";
|
||||
---
|
||||
<Layout title="Upload File | Barta-India">
|
||||
<main>
|
||||
<div class="container mx-auto px-4 flex flex-col space-y-4">
|
||||
<h1>Upload File</h1>
|
||||
<form action="https://apisp.dev2.cicdhosting.com/news/add-file/" method="post" enctype="multipart/form-data">
|
||||
<label for="file">Choose a file:</label>
|
||||
<input type="file" name="file" id="file" required>
|
||||
<br>
|
||||
<input type="submit" value="Upload">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
// function uploadFile() {
|
||||
// var fileInput = document.getElementById('fileInput');
|
||||
// var file = fileInput.files[0];
|
||||
|
||||
// if (file) {
|
||||
// var formData = new FormData();
|
||||
// formData.append('fileInput', file);
|
||||
|
||||
// fetch('https://apisp.dev2.cicdhosting.com/news/add-file/?action=save', {
|
||||
// method: 'POST',
|
||||
// body: formData
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// document.getElementById('status').innerText = data.message;
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error('Error:', error);
|
||||
// });
|
||||
// } else {
|
||||
// document.getElementById('status').innerText = 'Please select a file.';
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// function fileUpload(){
|
||||
// let formData = new FormData(document.getElementById('uploadForm'));
|
||||
// fetch(`https://apisp.dev2.cicdhosting.com/news/add-file/?action=save`, {
|
||||
// method: 'POST',
|
||||
// body: formData
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// console.log(data);
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.log('An error occurred', error);
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
Reference in New Issue
Block a user