1.启动类
@Override//图片上传的
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/imctemp-rainy/**").addResourceLocations("file:D:/JavaProject/SPring/SpringBootVue/src/main/resources/static/uploadimage/");
}
2.添加页面
html
<div class="form-group">
选择图片:<input type="file" name="file" id="file" /><p id="url"><img :src="newstype.nt_filename" width=200></p>
<input type="button" id="button" value="上传" ><input type="button" id="quxiao" value="取消">
</div>
jq
$("#button").click(function () {
//上传图片