最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

springframework6(MVC)設(shè)置文件上傳

2023-08-13 21:57 作者:herostears  | 我要投稿

spring6已經(jīng)不集成commonsupload,所以配置時(shí)使用StandardServletMultipartResolver


web.xml

<multipart-config>

<max-file-size>20848820</max-file-size>

<max-request-size>418018841</max-request-size>

<file-size-threshold>1048576</file-size-threshold>

</multipart-config>


spring配置文件

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


示例代碼:

@RequestMapping(value="/upload",method=RequestMethod.POST)

public String upload(@RequestParam MultipartFile file) {

if (!file.isEmpty())

{

System.out.println(file.getOriginalFilename());

}

return "hello";

}


HTML FORM:

<form action="/cmspring/hello/upload" method="post" enctype="multipart/form-data">

? <fieldset>

? ? <legend>Registration example</legend>

? ? <p>

? ? ? <input type="file" name="file" />

? ? </p>

? ? <p>

? ? ? <input type="submit" />

? ? </p>

? </fieldset>

</form>


springframework6(MVC)設(shè)置文件上傳的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
伊川县| 教育| 阆中市| 榆树市| 金山区| 紫金县| 崇文区| 寿宁县| 富民县| 营口市| 正镶白旗| 洛宁县| 阿克陶县| 英山县| 黎平县| 三穗县| 乐山市| 石屏县| 巍山| 巴林右旗| 白朗县| 饶阳县| 弥渡县| 三门县| 大同市| 江川县| 轮台县| 榆中县| 马鞍山市| 芜湖市| 乌恰县| 宝应县| 五华县| 津市市| 涪陵区| 盐源县| 德保县| 大丰市| 西充县| 邵阳县| 台中市|