Analyze MultipartForm-Data on form-based files with JSP

xiaoxiao2021-03-06  127

<% Int iTotalByte, iTotalRead, iReadByte; iTotalByte = request.getContentLength (); iTotalRead = 0; iReadByte = 0; byte [] Buffer = new byte [iTotalByte]; if (iTotalByte> 0) {for (; iTotalRead form data:
strbuffer
-> <% string strboundary = "- strcontettype.substring StrContentType.lastIndexof ("=") 1, strContentType.length ()); string stratay [] = strBuffer.split (strboundary);

String strSubString; int iBegin, iEnd; iBegin = 0; iEnd = 0; String strFieldName = ""; String strFieldValue = ""; String strFilePath = ""; String strFileName = ""; String strFileType = ""; boolean bTrue; bTrue = false; int ilocation = 0; for (int IINDEX = 1; IIndex -> <% // file data ubegin = strsubstring.indexof ("/ R / N / R / N ", Ibegin); strfieldValue = strsubstring.substring (Ibegin 4); strfieldValue = strfieldValue.substring (0, strfieldValue.lastIndexof (" / n ") - 1);%> File Path:
Strfilepath
file Name:
StrfileName
-> <

% Byte [] pfile = strfieldValue.getbytes (); byte [] pfileextend = new byte [pfile.length]; iocation = strbuffer.indexof ("filename = /", iocation; for (int Kindex = ip); ITOTALBYTE-2; Kindex ) {IF (buffer [Kindex] == 13 && buffer [Kindex 2] == 13) {iocation = KINDEX 4; Break;}} for (int NINDEX = 0; NINDEX form Name:
StrfieldName
Table Single Field Value:
StrfieldValue
-> <%} // Data Processing End}%> This (String) Session.getValue ("Table Single Domain Name") Returns a form field value, and (byte []) Session.getValue ("File Upload Control Domain Name") NEW BYTEARRAYINPUTSTREAM (Byte []) Call UpdateBinaryStream to update to the database.

转载请注明原文地址:https://www.9cbs.com/read-125745.html

New Post(0)