Retrieve uploaded relativePath file on server side

眉间皱痕 提交于 2019-12-25 00:12:38

问题


I'm using fileUpload from Primefaces (JSF framework) based on jQuery-File-Upload. I'm trying to make this component supporting drag&drop folder thanks to new File API of Firefox or Chrome. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory#Example So far, I've been able to make it happen thanks to passthrough attribute.

One of the interesting feature is "webkitRelativePath" allowing to know the relative path of an uploaded file.

I'm wondering how I could retrieve this info on server side, so I can create an object with this new info.

Thanks for your help.


回答1:


Well I just read his from fileupload.js:

_initXHRData: function (options) {
     ...
     formData.append(
     ($.type(options.paramName) === 'array' &&
          options.paramName[index]) || paramName,
          file,
          file.uploadName || file.name
     );
     ...
}

(file containing webKitRelativePath)

So I guess the info is already pass to the server, don't you think? Since i'm using Servlet 3.0, I should be able to retrieve it from Part object, finger crossed...



来源:https://stackoverflow.com/questions/45419598/retrieve-uploaded-relativepath-file-on-server-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!