java에서 MultipartRequest 관련질문
큰재
form에서 post보 받아온 값을 multipartrequest에 담아 디비에 저장하기
java.lang.illegalargumentexception: request cannot be nullpost로 form값을 던져주는데요
일단 제가 한 프로그램은
public string write(entity param, connection conn) throws exception {
preparedstatement stmt = null;
string success = false;
httpservletrequest request=null;//이부분이 에러인데 어떻게 해줘야 하나요 ㅠ.ㅠ
try {
이하생략...
/**파일등록**/
stringbuffer file_insert_sql = new stringbuffer();
file_insert_sql.append(디비에저장 쿼리 \n);
stmt = conn.preparestatement( file_insert_sql.tostring() );
int i=0;
int chkstmt = 0 ;
string save_folder = z:/photo_data/;// 데이터가 저장된 폴더(필요시 수정)
string real_folder = ;
string tmp_folder = \\tmp;
try
{
real_folder = save_folder;
tmp_folder = real_folder+tmp_folder+\\;
file fp = new file(tmp_folder);
fp.mkdir();
int nsizelimit = 3*1024*1024;
multipartrequest multi = new multipartrequest(request,tmp_folder,nsizelimit,euc-kr,new defaultfilerenamepolicy());
string[] strfilename = multi.getparametervalues(_innods_filename);
string[] strfilesize = multi.getparametervalues(_innods_filesize);
string[] strfilepath = multi.getparametervalues(_innods_filepath);
string[] strfilesortnum = multi.getparametervalues(_innods_filesortnum);
if (strfilename != null)
{
for (int s = 0; s strfilename.length; s++)
{
chkstmt ++ ;
stmt.setstring(++i,strfilename[s]);
stmt.setstring(++i,strfilesortnum[s]);
stmt.setstring(++i,strfilepath[s]);
stmt.setstring(++i,strfilesize[s]);
stmt.setstring(++i,dateformatutil.gettoday(yyyymmddhhmmss));
stmt.setstring(++i,param.getstring(reg_id));
system.out.println(strfilename : +strfilename[s]);
&; system.out.println(strfilesortnum : +strfilesortnum[s]);
system.out.println(strfilepath : +strfilepath[s]);
system.out.println(strfilesize : +strfilesize[s]);
stmt.addbatch();
}
fp.delete();
i = 0 ;
}
if ( chkstmt 0 )
stmt.executebatch();
}
catch (exception e) {
system.out.println(e);
throw e;
}
finally {
connectionhelper.close(stmt);
}
}
catch (exception e) {
throw e;
}
finally {
connectionhelper.close(stmt);
}
return success;
}
단순 form 값만 디비에 저장하고 싶어요 첨부는 업로드컴퍼넌트가 알아서 처리하거든요
부탁드립니다.
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700452 | c언어에서... 자료형 구분.... (3) | 시내 | 2025-07-05 |
2700422 | 버전에 관해 질문 | 라온제나 | 2025-07-04 |
2700393 | mysql이 갑자기!!!!!!!!!!!!!!!에러가;; (2) | 소미 | 2025-07-04 |
2700359 | 3.0 ) SimpleButton 상태 강제 변경 (3) | 희선 | 2025-07-04 |
2700304 | ie8 전용핵 문의 (3) | 여자 | 2025-07-03 |
2700281 | 이런경우 어떻게 코딩해야 표준에 따르는건가요? (6) | 늘솜 | 2025-07-03 |
2700230 | 질문이여 ! | 뿡뿡몬 | 2025-07-03 |
2700205 | 액션스크립트책 좀 추천해주세요. (10) | 화이트캣 | 2025-07-02 |
2700173 | 자바 소스인데 어떤게 에러인지..? (1) | 호빵녀 | 2025-07-02 |
2700142 | 하단이 붙어있는 가변 레이아웃구조 질문드립니다. | 이플 | 2025-07-02 |
2700089 | 이미지를 사다리꼴로 비틀게 하는 액션코드가 있나요? (4) | 여름 | 2025-07-01 |
2700033 | 배경에 그라데이션을 넣으려고 하는데요.. (4) | 화이티 | 2025-07-01 |
2700005 | [질문] TextField 객체의 실제 높이 알아오는 방법 ? | 천사의눈물 | 2025-07-01 |
2699978 | FileReferenceList를 이용하여 업로드시 자꾸 실행속도가 느리다는 팝업이... (10) | 데이비드 | 2025-06-30 |
2699944 | 자바스크립트가 많은 사이트는... (6) | 희나리 | 2025-06-30 |
2699918 | 브라우저마다 다른 input과 텍스트 정렬 (3) | 늘봄 | 2025-06-30 |
2699887 | 동적텍스트를 그래픽으로?? (2) | 족장 | 2025-06-30 |
2699862 | scope넣기 (1) | 아인 | 2025-06-29 |
2699835 | exe로 만드는 방법을....알려주세요.. (5) | 방방 | 2025-06-29 |
2699809 | 롤오버할때 백그라운드 이미지로할때 alt설명은 어떻게해야하죠?..ㅠ (4) | 반혈 | 2025-06-29 |