换上传二维码链接
This commit is contained in:
31
01.html
Normal file
31
01.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Image Upload Example</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Image Upload Example</h1>
|
||||
|
||||
<form id="imageUploadForm" enctype="multipart/form-data">
|
||||
<input type="file" id="imageInput" name="image" accept="image/*">
|
||||
<button type="button" onclick="uploadImage()">Upload Image</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function uploadImage() {
|
||||
const form = document.getElementById('imageUploadForm');
|
||||
console.log(form);
|
||||
const formData = new FormData(form);
|
||||
|
||||
axios.post('http://example.com/upload', formData)
|
||||
.then(response => {
|
||||
console.log('Image uploaded successfully');
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error uploading image:', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user