webuploader用java实现上传


<div id="uploader" class="wu-example">
								<div class="queueList">
									<div id="dndArea" class="placeholder">
										<div id="filePicker"></div>
										<p>或将照片拖到这里,单次最多可选300张</p>
									</div>
								</div>
								<div class="statusBar" style="display: none;">
									<div class="progress">
										<span class="text">0%</span> <span class="percentage"></span>
									</div>
									<div class="info"></div>
									<div class="btns">
										<div id="filePicker2"></div>
										<div class="uploadBtn">开始上传</div>
									</div>
								</div>
							</div>

<!-- webuploader -->
<link rel="stylesheet" type="text/css"
	href="/static/js/webuploader/css.css">
<link rel="stylesheet" type="text/css"
	href="/static/js/webuploader/image.css">
<script type="text/javascript" src="/static/js/webuploader/min.js"></script>
<script type="text/javascript"
	src="/static/js/webuploader/upload-image.js"></script>





// 实例化
    uploader = WebUploader.create({
        pick: {
            id: '#filePicker',
            label: '点击选择图片'
        },
        dnd: '#uploader .queueList',
        paste: document.body,
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        // swf文件路径
        [color=red]swf: '/static/js/webuploader/Uploader.swf',[/color]
        disableGlobalDnd: true,
        chunked: true,
        server: '/point/image/bulk.html',
        fileNumLimit: 300,
        fileSizeLimit: 50*1024*1024,//5M
        fileSingleSizeLimit: 5*1024*1024 //1M
    });



上传文件和普通的spring一样

	@RequestMapping("/bulk")
	@ResponseBody
	public String bulk(HttpServletRequest request, MultipartFile file) {
		String path = super.uploadFile(request, "file", true);
		return "1";
	}


引用

Spring MVC3.2开始支持通过Servlet3.0实现文件上传


<bean id="multipartResolver"class="org.springframework.web.multipart.support.StandardServletMultipartResolver"></bean>


具体可以看 http://www.cnblogs.com/chenying99/p/3746853.html




你可能感兴趣的:(java,html5)