gpt4 book ai didi

java - ServletFileUpload 异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:21:02 26 4
gpt4 key购买 nike

情况:我正在上传一个包含几千条记录的文件。最大文件大小为 100 kB,没有问题。但是,当文件大小超过 100 kB 时出现异常。

问题:我在以下行遇到异常:

List<DiskFileItem> items = upload.parseRequest(request);

我得到的异常是:

Error while processing multipart request:org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\DNDUtility\upload_tmp\upload_172408d6_14c27eae211__8000_00000001.tmp (The system cannot find the path specified) : Processing of multipart/form-data request failed. D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\DNDUtility\upload_tmp\upload_172408d6_14c27eae211__8000_00000001.tmp (The system cannot find the path specified)

我什至将 ServletUpload.MaxFileSize() 设置为 1 MB。但是,如果我尝试上传超过 100 kB 的文件,则会出现异常。

最佳答案

试试这个(将其设置为 3MB):

ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(3000 * 1024, tmpDir)); 

关于java - ServletFileUpload 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29105906/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com