123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>一次上传多张图片</title>
- <!-- 引入jQuery库 -->
- </head>
- <body>
- <h2>一次上传多张图片</h2>
- <form id="upload-form" enctype="multipart/form-data">
- <div class="form-group">
- <label for="images">选择多个图片:</label>
- <input type="file" name="images[]" id="images" multiple class="form-control">
- </div>
- <button type="button" id="upload-button" class="btn btn-primary">上传</button>
- </form>
- <div id="upload-status"></div>
- <script>
- $(document).ready(function () {
- $('#upload-button').click(function () {
- var formData = new FormData($('#upload-form')[0]);
- $.ajax({
- url: 'https://www.aa9169.com/Admin/Adminback/test_img', // 替换为你的服务器上传处理脚本的URL
- type: 'POST',
- data: formData,
- contentType: false,
- contentType: false,
- processData: false,
- success: function (response) {
- $('#upload-status').html(response);
- },
- error: function () {
- alert('上传失败,请重试!');
- }
- });
- });
- });
- </script>
- </body>
- </html>
|