问题
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