javascript - FormDataMultiPart files field is missing top directory -
i have java servlet uploads files in folder passed web page. works fine unless top folder contains folders , not files. example, if folder updating looks this:
topfolder +file1 +file2 +subfolder ++file3 ++file4
and choose topfolder upload, works fine , can recreate file structure on target server.
but if topfolder doesn't have files , looks this:
topfolder +subfolder ++file3 ++file4
i cannot recreate structure on target server because topfolder missing output. here code clarify:
map<string, list<formdatabodypart>> fields = multipart.getfields(); (string field : fields.keyset()) { logger.info("field="+field); list<formdatabodypart> formdatabodyparts = fields.get(field); (formdatabodypart part : formdatabodyparts) { formdatacontentdisposition disposition = part.getformdatacontentdisposition(); string filename = disposition.getfilename(); logger.info("filename="+filename); } }
the output of first case is:
field=files filename=topfolder/file1 filename=topfolder/file2 filename=topfolder/subfolder/file1 filename=topfolder/subfolder/file2
but output of second case is:
field=files filename=subfolder/file1 filename=subfolder/file2
how make formdatamultipart behave correctly?
Comments
Post a Comment