Diskfileupload upload = new diskfileupload ();
Upload. setsizemax (size );
Try {
Items = upload. parserequest (request );
} Catch (exception _ ex ){
Error = "the attachment is too large! ";
Request. setattribute ("error", error );
Return Mapping. findforward ("failure ");
}
Iterator iter = items. iterator ();
While (ITER. hasnext ()){
Fileitem item = (fileitem) ITER. Next ();
If (item. isformfield () {// if it is a normal form
If (item. getfieldname (). Equals ("board_id ")){
Board_id = item. getstring ();
} Else if (item. getfieldname (). Equals ("tznr ")){
Article_content = item. getstring ();
} Else if (item. getfieldname (). Equals ("artice_title ")){
Artice_title = item. getstring ();
} Else if (item. getfieldname (). Equals ("article_id ")){
Re_artice_id = item. getstring ();
// System. Out. println ("re_artice_id =" + re_artice_id );
}
} Else {// if it is a file field form
Is = item. getinputstream (); // gets the input stream of the uploaded file
Size = item. getsize (); // File Size
Filename = item. getname ();
If (! Filename. Equals ("")){
Filename = filename. substring (filename. lastindexof ("\") + 1 );
Filename_exec = filename. substring (filename. lastindexof (".") + 1 );
}
}
}