jsp - Error in uploading large size of files : EXC E:java.io.IOException: Posted content length of 12000169 exceeds limit of 1048576 -
i got error when try upload 11.4 mb text file.
exc e:java.io.ioexception: posted content length of 12000169 exceeds limit of 1048576
here's upload.jsp
<html> <body > <form action="read.jsp" method="post" enctype="multipart/form-data" > <head> <link rel="stylesheet" type="text/css" href="./css/master.css" /> <link rel="stylesheet" type="text/css" href="./css/nav.css" /> </head> <p> <h1>upload</h1><br> </p> <p> <h3> please specify file:</h3><br> <input type="file" name="file" size="40"> </p> <div> <input type="submit" value="send"> </div> </form> </body> </html>
here's read.jsp
<html> <head> <title>display</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <%@page import="java.io.*" %> <%@page import="com.oreilly.servlet.multipartrequest" %> </head> <body > <link rel="stylesheet" type="text/css" href="./css/master.css" /> <link rel="stylesheet" type="text/css" href="./css/nav.css" /> <p> <h1> read text file</h1><br> </p> <% string path="/apps/text/"; string filename=""; string phonemodel = getphonemodel(); file a1=null; try{ multipartrequest multi=new multipartrequest(request, path); a1=multi.getfile("file"); } catch (exception e){out.print("exc e:"+e);} try{ bufferedreader = new bufferedreader(new filereader(a1)); string filedata = ""; string crosssell=""; while((filedata = is.readline()) != null) { out.println(filedata } }catch(exception e){} %> <p> <h1>process completed!</h1><br> </p> </body> </html>
how can remove maximum limit of content length can upload large files?
multipartrequest has default max size of 1048576. can change when calling constructor.
multipartrequest multi=new multipartrequest(request, path, newsize);
Comments
Post a Comment