저는 JSP 폼을 사용하여 업로드하고 Servlet은 MySQL 데이터베이스에 큰 파일을 저장하려고합니다. 그리고 나는 자바에 대해 처음으로 익숙하기 때문에 정말 긴급한 도움이 필요합니다. String 값으로 파일을 저장하려고했지만 문자열 인덱스가 경계를 벗어났습니다.데이터베이스 안에 큰 파일을 저장하는 방법.
나는 (varchar File_Name, Blob File_data, Varchar File_Date)를 가진 데이터베이스 테이블 파일을 가지고 있습니다. BTW ** : 그리고 난 내가 서블릿에서이 코드를했다
내부에 업로드 된 파일을 저장해야 "DiskFileUpload, parseRequest는"취소 선을 왜 내가 아무 생각이 없다?
try {
InputStream uploadedFile = null;
<strike>DiskFileUpload</strike> fu = new </strike>DiskFileUpload</strike>();
// If file size exceeds, a FileUploadException will be thrown
fu.setSizeMax(10000000);
List fileItems = fu.<strike>parseRequest</strike>(request);
Iterator itr = fileItems.iterator();
while (itr.hasNext()) {
FileItem fi = (FileItem) itr.next();
//Check if not form field so as to only handle the file inputs
//else condition handles the submit button input
if (!fi.isFormField()) { // If the form fiel is a file
uploadedFile = fi.getInputStream();
}
업로드 파일을 Blob 속성에 저장하려면 어떤 유형의 데이터를 변환해야합니까?
이 문제를 어떻게 극복 할 수 있습니까? – Lujain