layui多图,多音频,多视频,多文件上传

该博客展示了如何使用 layui 框架实现多图、多音频、多视频及多文件的上传功能,包括jsp页面设计和上传实现方法。
摘要由CSDN通过智能技术生成

 示例图:

1. jsp页面

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>">
	<!-- 下拉框 -->
	<link rel="stylesheet" href="static/ace/css/chosen.css" />
	<!-- jsp文件头和头部 -->
	<%@ include file="../../system/index/top.jsp"%>
	<!-- 日期框 -->
	<link rel="stylesheet" href="static/ace/css/datepicker.css" />
	<link rel="stylesheet" href="static/layui/css/layui.css" />
	<style type="text/css">
		.layui-upload-list {
			position: relative;
			display: flex;
			flex-wrap: wrap;
		}
		.layui-upload-list div{
			position: relative;
		}
		.layui-upload-list div .delete{
			position: absolute;
			top: 0px;
			right: 10px;
			width: 20px;
			height: 20px;
			border-radius: 100%;
			background-color: #FFF;
			color: red;
			font-weight: bold;
		}
		.layui-upload-img {
			width: 92px;
			height: 92px;
			margin: 0px 10px 0px 10px;
		}
		.layui-upload-audio {
			width: 300px;
			height: 50px;
			margin: 0px 10px 0px 10px;
		}
		.layui-upload-video {
			width: 300px;
			height: auto;
			margin: 0px 10px 0px 10px;
		}
	</style>
	</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
	<!-- /section:basics/sidebar -->
	<div class="main-content">
		<div class="main-content-inner">
			<div class="page-content">
				<div class="row">
					<div class="col-xs-12">
					
					<form action="info/${msg }.do" name="Form" id="Form" method="post">
						<input type="hidden" name="INFO_ID" id="INFO_ID" value="${pd.INFO_ID}"/>
						<div id="zhongxin" style="padding-top: 13px;">

						<table id="table_report" class="table table-striped table-bordered table-hover">
							<tr>
								<td style="width:75px;text-align: right;padding-top: 13px;">图片:</td>
								<td>
									<div class="layui-upload">
										<button type="button" class="layui-btn" id="uploadPics">上传图片</button><span style="color:red">&nbsp;&nbsp;&nbsp;*仅上传图片格式:jpg,jpeg,png,bmp,gif</span>
										<div class="layui-upload-list" id="demo1"></div>
									</div>
									<input type="hidden" name="PICTURES" id="PICTURES" value="${pd.PICTURES}" style="width:98%;margin-top: 10px"/>
									<input type="hidden" name="THUMBNAILS" id="THUMBNAILS" value="${pd.THUMBNAILS}"  style="width:98%;"/>
								</td>
							</tr>
							<tr>
								<td style="width:75px;text-align: right;padding-top: 13px;">音频:</td>
								<td>
									<div class="layui-upload">
										<button type="button" class="layui-btn" id="uploadAudios">上传音频</button><span style="color:red">&nbsp;&nbsp;&nbsp;*仅上传音频格式:wav,mp3,ogg,webm</span>
										<div class="layui-upload-list" id="demo2"></div>
									</div>
									<input type="hidden" name="AUDIOS" id="AUDIOS" value="${pd.AUDIOS}" style="width:98%;margin-top: 10px"/>
								</td>
							</tr>
							<tr>
								<td style="width:75px;text-align: right;padding-top: 13px;">视频:</td>
								<td>
									<div class="layui-upload">
										<button type="button" class="layui-btn" id="uploadVideos">上传视频</button><span style="color:red">&nbsp;&nbsp;&nbsp;*仅上传视频格式:mp4,webm,ogg</span>
										<div class="layui-upload-list" id="demo3"></div>
									</div>
									<input type="hidden" name="VIDEOS" id="VIDEOS" value="${pd.VIDEOS}" style="width:98%;margin-top: 10px"/>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<input type="hidden" name="APPENDIXS" id="APPENDIXS" value="${pd.APPENDIXS}" style="width:98%;margin-top: 10px"/>
									<div class="layui-upload" style="margin-bottom:25px">
			                          <button type="button" class="layui-btn" id="uploadFiles">上传文件</button><span style="color:red">&nbsp;&nbsp;&nbsp;*仅上传文件格式:pdf</span>
			                          <div class="layui-upload-list">
			                            <table class="layui-table">
			                              <thead>
			                                <tr>
				                                <th>文件名</th>
				                                <th>状态</th>
				                                <th style="width:240px">操作</th>
			                              	</tr>
			                              </thead>
			                              <tbody id="demo4">
			                              </tbody>
			                            </table>
			                          </div>
			                        </div>
								</td>
							</tr>
							<tr>
								<td style="text-align: center;" colspan="10">
									<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
									<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
								</td>
							</tr>
						</table>
						</div>
						<div id="zhongxin2
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值