Using Openui5 UploadCollection with backend java not being able to upload file -
we have developed openui5 application has working except ability upload files. want use uploadcollection in openui5 library, when servlet get's called on backend java side message not multipart/form-data when parsing request. did work when using openui5 fileupload component, not uploadcollection. there need set make multipart, or there different way need parse request. side not servlet called file attached start upload 1 one each file attached
thanks in advance ron
here front end xml file part uploadcollection
<uploadcollection id="uploadcollection" multiple="false" samefilenameallowed="true" showseparators="all" change="onchangeuploadcollection" filedeleted="onfiledeleted" selectionchange="onselectionchange" uploadcomplete="onuploadcompleteuploadcollection" beforeuploadstarts="onbeforeuploadstarts" items="{path : '/record/uploadcollectionitems', templateshareable : 'true'}" uploadurl="{/record/upload}" mode="singleselectleft"> <!-- selectionchange="onselectionchange" items="{path : '/items', templateshareable : 'true'}" --> <!-- beforeuploadstarts="onbeforeuploadstarts" uploadterminated="onuploadterminated" --> <toolbar> <overflowtoolbar id="myid"> <title id="attachmenttitle" /> <toolbarspacer /> <button id="downloadbutton" text="download" press="ondownloaditem" enabled="false" type="transparent"></button> <!-- <button id="versionbutton" text="upload new version" press="onversion" enabled="false" type="transparent"></button> --> <uploadcollectiontoolbarplaceholder></uploadcollectiontoolbarplaceholder> </overflowtoolbar> </toolbar> <items> <uploadcollectionitem documentid="{documentid}" filename="{filename}" mimetype="{mimetype}" url="{url}" enableedit="true" enabledelete="true" visibledelete="true" visibleedit="true" statuses="{path : '/record/uploadcollectionitems', templateshareable : 'true'}" selected="false"> <statuses> <objectstatus title="{status}" visible="false" state="{state}" icon="{icon}" icondensityaware="{icondensityaware}" textdirection="{textdirection}" /><!-- text="{text}" --> </statuses> </uploadcollectionitem> </items> </uploadcollection>
here backend java servlet
public void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { printwriter out = response.getwriter(); jsonobject ret = new jsonobject(); try { string uploadfolder; fileitem ffileitem = null; fileitemfactory ffactory = new diskfileitemfactory(); servletfileupload fupload = new servletfileupload(ffactory); boolean ismultipart; ismultipart = servletfileupload.ismultipartcontent(request); list fitems = fupload.parserequest(request); // fails here iterator flter = fitems.iterator(); hashmap fformfields = new hashmap(); .... other code here ret.put("success", true); ret.put("code", "0101"); // ret.put("msg", "form has uploaded successfully."); } catch (exception exc) { ret.put("success", false); ret.put("msg", exc.getmessage()); } out.println(ret.tostring()); }
Comments
Post a Comment