国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【SpringMVC】一行代碼完成文件上傳&JRebel的使用

這篇具有很好參考價值的文章主要介紹了【SpringMVC】一行代碼完成文件上傳&JRebel的使用。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

目錄

引言

一、JRebel的使用

1.1.安裝JReble

1.2.反向代理工具

1.3.離線使用

二、文件上傳

2.1.公共文件跳轉(zhuǎn)

2.2.添加依賴

2.3.配置文件上傳解析器

?2.4.圖片路徑配置Tomcat

2.5.前端代碼

2.6.文件上傳實現(xiàn)

三、文件下載

3.1.Controller層

3.2.前端代碼

四、多文件上傳

4.1.Controller層

4.2.前端代碼


引言

在以往的寫代碼過程中,我們肯定會遇到客戶有文件上傳的需求,寫過的同志都知道代碼量是有的而且比較繁瑣,今天這篇博客就來介紹一個Java庫commons-fileupload,該庫是Apache的一個開源Java庫,它提供了一種簡單的方式來上傳和處理文件。它是Java Servlet API的一部分,可以方便地在Web應(yīng)用程序中實現(xiàn)文件上傳功能。

一、JRebel的使用

在講解文件上傳之前,先向大家推薦一下JRebel的使用,JRebel的主要功能是實現(xiàn)熱部署,節(jié)省了大量重啟時間,提高了個人開發(fā)效率。

1.1.安裝JReble

我這里以IDEA為例,在Settings里點擊Plugins在Marketplace處搜索jrebel,選擇第一個安裝即可。

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

安裝后重啟IDEA即可。

1.2.反向代理工具

這里會使用一個反向代理工具ReverseProxy_windows_amd64,而JRebel是一個Java虛擬機插件,它們之間沒有直接的關(guān)系。但是,如果您在使用JRebel時遇到了問題,可以嘗試先啟動ReverseProxy_windows_amd64,然后再使用JRebel。

下載地址
Release v1.4 · ilanyu/ReverseProxy · GitHub

下載完成后打開代理ReverseProxy_windows_amd64.exe再jrebel啟動項目

(注意:激活成功前不要關(guān)閉反向代理程序)

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

選擇TeamURL激活

第一行輸入http://127.0.0.1:8888/GUID

第二行輸入電子郵箱即可。

?https://www.guidgen.com/(生成GUID鏈接)

1.3.離線使用

激活后一定要手動切換到離線模式進行使用,過程如圖 如下步驟進行操作:

File ?Settings?JRebel ?Work offline ?OK

(注意點擊Work offline就會變?yōu)閃ork online)

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

下面就可以進行我們的SpringMVC文件上傳講解了。

二、文件上傳

2.1.公共文件跳轉(zhuǎn)

該類是方便我們少寫重復(fù)跳轉(zhuǎn)頁面的代碼需要跳什么頁面jsp的請求上加上/page即可。

@Controller
@RequestMapping("/page")
public class InputController {

    @RequestMapping("{page}")
    public String to(@PathVariable("page") String page){
        return page;
    }


    @RequestMapping("/{dir}/{page}")
    public String todir(@PathVariable("dir") String dir,
                        @PathVariable("page") String page){
        return dir+"/"+page;
    }

}

2.2.添加依賴

處理文件上傳的Java庫。

<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.3</version>
</dependency>

2.3.配置文件上傳解析器

將配置文件放入Spring-mvc.xml中

 <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- 必須和用戶JSP 的pageEncoding屬性一致,以便正確解析表單的內(nèi)容 -->
        <property name="defaultEncoding" value="UTF-8"></property>
        <!-- 文件最大大小(字節(jié)) 1024*1024*50=50M-->
        <property name="maxUploadSize" value="52428800"></property>
        <!--resolveLazily屬性啟用是為了推遲文件解析,以便捕獲文件大小異常-->
        <property name="resolveLazily" value="true"/>
    </bean>

MultipartResolver是用于處理文件上傳,當(dāng)收到請求時DispatcherServlet的checkMultipart()方法會調(diào)用MultipartResolver的isMultipart()方法判斷請求中是否包含文件,如果請求數(shù)據(jù)中包含文件,則調(diào)用MultipartResolver的resolverMultipart()方法對請求的數(shù)據(jù)進行解析,然后將文件數(shù)據(jù)解析MultipartFile并封裝在MultipartHTTPServletRequest(繼承了HTTPServletRequest)對象中,最后傳遞給Controller。 ?

?2.4.圖片路徑配置Tomcat

為了我們的后期維護,所以將本地圖片路徑與Tomcat訪問路徑進行配置文件的保存。

PropertiesUtil.java

public class PropertiesUtil {
	public static String getValue(String key) throws IOException {
		Properties p = new Properties();
		InputStream in = PropertiesUtil.class.getResourceAsStream("/resource.properties");
		p.load(in);
		return p.getProperty(key);
	}
	
}

resource.properties

dir=E:/oa/idea/upload/
server=/upload/

?點擊菜單欄上的Tomcat選擇Edit Configurations【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

2.5.前端代碼

list.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://jsp.veryedu.cn" prefix="z"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link
            
            rel="stylesheet">
    <script
            src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.0/js/bootstrap.js"></script>
    <title>學(xué)生管理首頁</title>
    <style type="text/css">
        .page-item input {
            padding: 0;
            width: 40px;
            height: 100%;
            text-align: center;
            margin: 0 6px;
        }

        .page-item input, .page-item b {
            line-height: 38px;
            float: left;
            font-weight: 400;
        }

        .page-item.go-input {
            margin: 0 10px;
        }
    </style>
</head>
<body>
<form class="form-inline"
      action="${pageContext.request.contextPath }/student/list" method="post">
    <div class="form-group mb-2">
        <input type="text" class="form-control-plaintext" name="sname"
               placeholder="請輸入學(xué)生名稱">
        <!-- 			<input name="rows" value="20" type="hidden"> -->
        <!-- 不想分頁 -->
                <%--<input name="pagination" value="false" type="hidden">--%>
    </div>
    <button type="submit" class="btn btn-primary mb-2">查詢</button>
    <a class="btn btn-primary mb-2" href="${pageContext.request.contextPath }/student/PreSave">新增</a>
</form>

<table class="table table-striped ">
    <thead>
    <tr>
        <th scope="col">學(xué)生ID</th>
        <th scope="col">學(xué)生名稱</th>
        <th scope="col">學(xué)生照片</th>
        <th scope="col">學(xué)生性別</th>
        <th scope="col">操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach  var="s" items="${slist }">
        <tr>
            <td>${s.sid }</td>
            <td>${s.sname }</td>
            <td>
                <img src="${s.sage }" style="width: 50px;height: 50px;">
            </td>
            <td>${s.ssex }</td>
            <td>
                <a href="${pageContext.request.contextPath }/student/PreSave?sid=${s.sid}">修改</a>
                <a href="${pageContext.request.contextPath }/student/del?sid=${s.sid}">刪除</a>
                <a href="${pageContext.request.contextPath }/page/student/upload?sid=${s.sid}">上傳照片</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<!-- 這一行代碼就相當(dāng)于前面分頁需求前端的幾十行了 -->
<z:page pageBean="${pageBean }"></z:page>
<%--${pageBean }
${slist}--%>
</body>
</html>

upload.jsp?


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>學(xué)生照片上傳</title>
</head>
<body>
<form action="${pageContext.request.contextPath }/student/upload" method="post" enctype="multipart/form-data">
    <label>學(xué)生編號:</label><input type="text" name="sid" readonly="readonly" value="${param.sid}"/><br/>
    <label>學(xué)生圖片:</label><input type="file" name="simg"/><br/>
    <input type="submit" value="上傳圖片"/>
</form>
</body>
</html>

2.6.文件上傳實現(xiàn)

StudentController.java


@Controller
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentBiz stubiz;

//    增
    @RequestMapping("/add")
    public String add(Student student){
        stubiz.insertSelective(student);
        return "redirect:list";
    }

    //    刪
    @RequestMapping("/del")
    public String del(Student student){
        stubiz.deleteByPrimaryKey(student.getSid());
        return "redirect:list";
    }


//    查
    @RequestMapping("/list")
    public String list(Student student, HttpServletRequest request){
        PageBean pageBean=new PageBean();
        pageBean.setRequest(request);
        List<Student> students = stubiz.selectBySnamePager(student, pageBean);
        request.setAttribute("slist",students);
        request.setAttribute("pageBean",pageBean);
        return "student/list";
    }
//    改
    @RequestMapping("/edit")
    public String edit(Student student){
        stubiz.updateByPrimaryKeySelective(student);
        return "redirect:list";
    }
//    模糊分頁查詢
    @RequestMapping("/PreSave")
    public String PreSave(Student student, HttpServletRequest request){
        if(student!=null && student.getSid()!=null){
            Student s = stubiz.selectByPrimaryKey(student.getSid());
            request.setAttribute("s",s);
        }
        return "student/edit";
    }

    //文件上傳
    @RequestMapping("/upload")
    public String upload(MultipartFile simg,Student student) throws IOException {
        //將上傳圖片保存到服務(wù)器中的指定位置
        String dir= PropertiesUtil.getValue("dir");
        String server=PropertiesUtil.getValue("server");
        String filename = simg.getOriginalFilename();

        FileUtils.copyInputStreamToFile(simg.getInputStream(),new File(dir+filename));

        //將上傳的圖片保存到數(shù)據(jù)庫
        student.setSage(server+ filename);
        stubiz.updateByPrimaryKeySelective(student);
    return "redirect:list";
     }


}

效果展示:

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

這時候查看我們所配置的本地路徑中也有圖片了。

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

三、文件下載

3.1.Controller層

StudentController.java

@Controller
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentBiz stubiz;

//    增
    @RequestMapping("/add")
    public String add(Student student){
        stubiz.insertSelective(student);
        return "redirect:list";
    }

    //    刪
    @RequestMapping("/del")
    public String del(Student student){
        stubiz.deleteByPrimaryKey(student.getSid());
        return "redirect:list";
    }


//    查
    @RequestMapping("/list")
    public String list(Student student, HttpServletRequest request){
        PageBean pageBean=new PageBean();
        pageBean.setRequest(request);
        List<Student> students = stubiz.selectBySnamePager(student, pageBean);
        request.setAttribute("slist",students);
        request.setAttribute("pageBean",pageBean);
        return "student/list";
    }
//    改
    @RequestMapping("/edit")
    public String edit(Student student){
        stubiz.updateByPrimaryKeySelective(student);
        return "redirect:list";
    }
//    模糊分頁查詢
    @RequestMapping("/PreSave")
    public String PreSave(Student student, HttpServletRequest request){
        if(student!=null && student.getSid()!=null){
            Student s = stubiz.selectByPrimaryKey(student.getSid());
            request.setAttribute("s",s);
        }
        return "student/edit";
    }

    //文件上傳
    @RequestMapping("/upload")
    public String upload(MultipartFile simg,Student student) throws IOException {
        //將上傳圖片保存到服務(wù)器中的指定位置
        String dir= PropertiesUtil.getValue("dir");
        String server=PropertiesUtil.getValue("server");
        String filename = simg.getOriginalFilename();

        FileUtils.copyInputStreamToFile(simg.getInputStream(),new File(dir+filename));

        //將上傳的圖片保存到數(shù)據(jù)庫
        student.setSage(server+ filename);
        stubiz.updateByPrimaryKeySelective(student);
    return "redirect:list";
     }


     //文件下載
     @RequestMapping(value="/download")
     public ResponseEntity<byte[]> download(Student student, HttpServletRequest req){

         try {
             //先根據(jù)文件id查詢對應(yīng)圖片信息
             Student students = this.stubiz.selectByPrimaryKey(student.getSid());
             String diskPath = PropertiesUtil.getValue("dir");
             String reqPath = PropertiesUtil.getValue("server");
             String realPath = students.getSage().replace(reqPath,diskPath);
             String fileName = realPath.substring(realPath.lastIndexOf("/")+1);
             //下載關(guān)鍵代碼
             File file=new File(realPath);
             HttpHeaders headers = new HttpHeaders();//http頭信息
             String downloadFileName = new String(fileName.getBytes("UTF-8"),"iso-8859-1");//設(shè)置編碼
             headers.setContentDispositionFormData("attachment", downloadFileName);
             headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
             //MediaType:互聯(lián)網(wǎng)媒介類型  contentType:具體請求中的媒體類型信息
             return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.OK);
         }catch (Exception e){
             e.printStackTrace();
         }
         return null;
     }


}

3.2.前端代碼

list.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://jsp.veryedu.cn" prefix="z"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link
            
            rel="stylesheet">
    <script
            src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.0/js/bootstrap.js"></script>
    <title>學(xué)生管理首頁</title>
    <style type="text/css">
        .page-item input {
            padding: 0;
            width: 40px;
            height: 100%;
            text-align: center;
            margin: 0 6px;
        }

        .page-item input, .page-item b {
            line-height: 38px;
            float: left;
            font-weight: 400;
        }

        .page-item.go-input {
            margin: 0 10px;
        }
    </style>
</head>
<body>
<form class="form-inline"
      action="${pageContext.request.contextPath }/student/list" method="post">
    <div class="form-group mb-2">
        <input type="text" class="form-control-plaintext" name="sname"
               placeholder="請輸入學(xué)生名稱">
        <!-- 			<input name="rows" value="20" type="hidden"> -->
        <!-- 不想分頁 -->
                <%--<input name="pagination" value="false" type="hidden">--%>
    </div>
    <button type="submit" class="btn btn-primary mb-2">查詢</button>
    <a class="btn btn-primary mb-2" href="${pageContext.request.contextPath }/student/PreSave">新增</a>
</form>

<table class="table table-striped ">
    <thead>
    <tr>
        <th scope="col">學(xué)生ID</th>
        <th scope="col">學(xué)生名稱</th>
        <th scope="col">學(xué)生照片</th>
        <th scope="col">學(xué)生性別</th>
        <th scope="col">操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach  var="s" items="${slist }">
        <tr>
            <td>${s.sid }</td>
            <td>${s.sname }</td>
            <td>
                <img src="${s.sage }" style="width: 50px;height: 50px;">
            </td>
            <td>${s.ssex }</td>
            <td>
                <a href="${pageContext.request.contextPath }/student/PreSave?sid=${s.sid}">修改</a>
                <a href="${pageContext.request.contextPath }/student/del?sid=${s.sid}">刪除</a>
                <a href="${pageContext.request.contextPath }/page/student/upload?sid=${s.sid}">上傳照片</a>
                <a href="${pageContext.request.contextPath }/student/download?sid=${s.sid}">下載照片</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<!-- 這一行代碼就相當(dāng)于前面分頁需求前端的幾十行了 -->
<z:page pageBean="${pageBean }"></z:page>
<%--${pageBean }
${slist}--%>
</body>
</html>

效果演示:?

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

四、多文件上傳

由于我的數(shù)據(jù)庫表中沒有存儲多個圖片的字段,就不過數(shù)據(jù)庫演示了。

4.1.Controller層

  //多文件上傳
     @RequestMapping("/uploads")
     public String uploads(HttpServletRequest req, Student student, MultipartFile[] files){
         try {
             StringBuffer sb = new StringBuffer();
             for (MultipartFile cfile : files) {
                 //思路:
                 //1) 將上傳圖片保存到服務(wù)器中的指定位置
                 String dir = PropertiesUtil.getValue("dir");
                 String server = PropertiesUtil.getValue("server");
                 String filename = cfile.getOriginalFilename();
                 FileUtils.copyInputStreamToFile(cfile.getInputStream(),new File(dir+filename));
                 sb.append(filename).append(",");
             }
             System.out.println(sb.toString());

         } catch (Exception e) {
             e.printStackTrace();
         }
         return "redirect:list";
     }

4.2.前端代碼

 <a href="${pageContext.request.contextPath }/page/student/uploads">多文件上傳</a>




<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="${pageContext.request.contextPath }/student/uploads" method="post" enctype="multipart/form-data">
    <input type="file" name="files" multiple>
    <button type="submit">上傳</button>
</form>
</body>
</html>

效果演示:

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel

到這里我的分享就結(jié)束了,歡迎到評論區(qū)探討交流??!

??如果覺得有用的話還請點個贊吧 ??

【SpringMVC】一行代碼完成文件上傳&JRebel的使用,Spring MVC,SpringMVC,Jrebel文章來源地址http://www.zghlxwxcb.cn/news/detail-728727.html

到了這里,關(guān)于【SpringMVC】一行代碼完成文件上傳&JRebel的使用的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 使用ChatGPT完成程序開發(fā)——目標(biāo):不寫一行代碼完成圖像識別并點擊

    使用ChatGPT完成程序開發(fā)——目標(biāo):不寫一行代碼完成圖像識別并點擊

    ????????本文作為一個使用AI開發(fā)的思路,讓更多的人可以利用AI完成一些簡單的程序,文中使用的是國內(nèi)鏡像GTP3.5 源碼: GitHub - kasimshi/testCV: AI編寫的OpenCV圖像識別例子 GTP鏡像: ? ? 對AI描述我們要做的功能,讓它給給初步的思路和方向 作為新手,讓AI推薦容易使用的相關(guān)

    2023年04月25日
    瀏覽(20)
  • 還在手動封裝文件上傳?快來試試這款一行代碼實現(xiàn)多平臺文件存儲的工具!

    大家好,我是 Java陳序員 。 文件上傳下載,是我們在開發(fā)中經(jīng)常會遇到的需求! 無論是本地存儲、還是云存儲,我們可以自己封裝 API 來實現(xiàn)功能。 今天,給大家介紹一款一行代碼實現(xiàn)多平臺文件存儲的工具,開箱即用! 關(guān)注微信公眾號:【Java陳序員】,獲取 開源項目分

    2024年01月18日
    瀏覽(23)
  • 教你如何根據(jù)需求編寫測試用例,不用寫一行代碼,使用ChatGPT4自動完成。

    教你如何根據(jù)需求編寫測試用例,不用寫一行代碼,使用ChatGPT4自動完成。

    首先來張效果圖,需求我是放到requirements.txt文檔里,輸出的測試用例是放到test_case1.txt,整個代碼我是讓ChatGPT4自動給我寫的。 我用的prompt提示語是: 我的想法是這樣,通過Python代碼,和API keys來實現(xiàn),讀取產(chǎn)品需求說明書文檔,自動產(chǎn)生測試用例文檔。能否實現(xiàn),請給我具

    2024年02月08日
    瀏覽(24)
  • 【SpringMVC】| 使用SpringMVC實現(xiàn)文件上傳 | 下載功能

    【SpringMVC】| 使用SpringMVC實現(xiàn)文件上傳 | 下載功能

    SpringMVC是一個Web框架,提供了許多有用的功能,包括文件上傳和下載。通過SpringMVC上傳和下載文件,您可以允許用戶上傳文件,以便將它們存儲在服務(wù)器上,或者允許用戶從服務(wù)器上下載文件。這些都可以為您的應(yīng)用程序添加有用的功能,例如: 允許用戶上傳和共享文件 -

    2024年02月02日
    瀏覽(128)
  • ROS安裝:一行代碼安裝完成ROS

    ubuntu20上安裝的是noetic版本, ubuntu18上安裝的是melodic版本的。 ubuntu20一行代碼安裝腳本如下: ubuntu18一行代碼安裝腳本如下: 如果報錯沒有curl請安裝

    2024年01月16日
    瀏覽(15)
  • 求其最大公約數(shù)和最小公倍數(shù),一行代碼完成

    題目:輸入兩個正整數(shù) m 和 n,求其最大公約數(shù)和最小公倍數(shù)。 求出最大公約數(shù)就行,最小公倍數(shù)用m*n除以最大公約數(shù)就行

    2024年02月05日
    瀏覽(26)
  • 一行代碼就能完成的事情,為什么要寫兩行?

    一行代碼就能完成的事情,為什么要寫兩行?

    前后端面試題庫 (面試必備) 推薦:★★★★★ 地址:前端面試題庫??web前端面試題庫 VS java后端面試題庫大全 三元運算符 用三元運算符代替簡單的 if else 改用三元運算符,一行就能搞定 復(fù)雜的判斷三元運算符就有點不簡單易懂了 判斷 當(dāng)需要判斷的情況不止一個時,第一個

    2023年04月16日
    瀏覽(16)
  • 使用puppeteer完成監(jiān)聽瀏覽器下載文件并保存到自己本地或服務(wù)器上完成上傳功能

    獲取網(wǎng)站點擊的下載pdf,并把pdf重命名再上傳到COS云上面 “puppeteer”: “^19.7.2”, “egg”: “^3.15.0”, // 服務(wù)期用egg搭的 文件服務(wù)使用COS騰訊云 獲取瀏覽器下載事件,并把文件保存到本地 在保存到本地前監(jiān)聽此文件夾,如果有文件則獲取并上傳 加timer做防抖是為了防止在文

    2024年04月15日
    瀏覽(31)
  • 前后端分離架構(gòu)文件上傳與下載(含Vue?+?Spring完整代碼)

    本文采用前后端分離式的架構(gòu),其中涉及到文件下載的需求,文件下載在任何系統(tǒng)中都是比較常見的。對于前后端分離架構(gòu)的文件下載與往常的寫法有些許不同(試過直接使用a標(biāo)簽,href填上下載地址,發(fā)現(xiàn)行不通),所以經(jīng)過查找與嘗試,以下文件下載前后端實現(xiàn)流程供大家參

    2024年02月15日
    瀏覽(132)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包