following function uploading multiple files webpage. files in list of multipartfile --> files variable.i'm unable iterate on every file. log.info("file"+files) printed file[]. means files returns '[]'. mean? going wrong?
public string addnodeanddocnew(treetype treetype, objectid parentnodeid, nodetype nodetype, string displayname, string attrlist, list<multipartfile> files, string userid, string passwd) { string result = ""; log.info("file"+ files); log.info("userid=" + userid); log.info("passwd=" + passwd); log.info("nodetype=" + nodetype); log.info("displayname=" + displayname); if (attrlist != null) log.info("attributeslist=" + attrlist.tostring()); objectid nodeid = null; for(multipartfile file : files) { log.info("yess"); if (file.isempty()) { log.info("nothing attached, adding node, not doc"); nodeid = addnode(treetype, parentnodeid, nodetype, displayname, attrlist, userid, passwd); if (nodeid != null) log.info("just added node, no doc sent"); } else { log.info("file=" + file.getoriginalfilename()); nodeid = addnode(treetype, parentnodeid, nodetype, displayname, attrlist, userid, passwd); if (nodeid != null) { docservice.uploaddoc(nodeid, file, userid, passwd); log.info("added node, , doc"); } else { log.info("addnode() returned null"); } } if (nodeid != null) { log.info("addnodeanddoc completed node id : " + nodeid.tostring()); result += nodeid.tostring()+ "@@"; } else return null; } log.info("yess1"); return result; }
however log.info(files) printed file[].
so, given array empty. thats why can't iterate on it! ;)
Comments
Post a Comment